{"id":1022,"date":"2023-04-25T15:59:51","date_gmt":"2023-04-25T07:59:51","guid":{"rendered":"https:\/\/white-night.club\/?p=1022"},"modified":"2023-11-09T11:07:56","modified_gmt":"2023-11-09T03:07:56","slug":"ad3","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/04\/25\/ad3\/","title":{"rendered":"1784.\u00a0\u68c0\u67e5\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\u5b57\u6bb5"},"content":{"rendered":"\n<p>\u7ed9\u4f60\u4e00\u4e2a\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32&nbsp;s&nbsp;\uff0c\u8be5\u5b57\u7b26\u4e32&nbsp;\u4e0d\u542b\u524d\u5bfc\u96f6&nbsp;\u3002<\/p>\n\n\n\n<p>\u5982\u679c&nbsp;s&nbsp;\u5305\u542b&nbsp;\u96f6\u4e2a\u6216\u4e00\u4e2a\u7531\u8fde\u7eed\u7684&nbsp;&#8216;1&#8217;&nbsp;\u7ec4\u6210\u7684\u5b57\u6bb5&nbsp;\uff0c\u8fd4\u56de&nbsp;true\u200b\u200b\u200b \u3002\u5426\u5219\uff0c\u8fd4\u56de&nbsp;false&nbsp;\u3002<\/p>\n\n\n\n<p>\u793a\u4f8b 1\uff1a<\/p>\n\n\n\n<p>\u8f93\u5165\uff1as = &#8220;1001&#8221;<br>\u8f93\u51fa\uff1afalse<br>\u89e3\u91ca\uff1a\u7531\u8fde\u7eed\u82e5\u5e72\u4e2a&nbsp;&#8216;1&#8217; \u7ec4\u6210\u7684\u5b57\u6bb5\u6570\u91cf\u4e3a 2\uff0c\u8fd4\u56de false<\/p>\n\n\n\n<p>\u793a\u4f8b 2\uff1a<\/p>\n\n\n\n<p>\u8f93\u5165\uff1as = &#8220;110&#8221;<br>\u8f93\u51fa\uff1atrue<\/p>\n\n\n\n<p>\u63d0\u793a\uff1a<\/p>\n\n\n\n<p>1 &lt;= s.length &lt;= 100<\/p>\n\n\n\n<p>s[i]\u200b\u200b\u200b\u200b \u4e3a&nbsp;&#8216;0&#8217;&nbsp;\u6216&nbsp;&#8216;1&#8217;<\/p>\n\n\n\n<p>s[0]&nbsp;\u4e3a&nbsp;&#8216;1&#8217;<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>\u521d\u59cb\u4ee3\u7801<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Solution {\npublic:\n    bool checkOnesSegment(string s) {\n        \n    }\n};<\/code><\/pre>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u89e3\u9898\u601d\u8def<\/p>\n<cite><em>\u66b4\u529bor\u81ea\u5e26\u51fd\u6570<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u8bf4\u767d\u4e86\u5c31\u662f\u5728\u8fd9\u4e2a\u5b57\u7b26\u4e32\u4e2d\uff0c\u627e\u6709\u6ca1\u6709\u201c01\u201d\u5b57\u4e32\u3002\u6709\u5c31\u8fd4\u56defalse\uff0c\u6ca1\u6709\u5c31\u8fd4\u56detrue\u3002<\/p>\n\n\n\n<p>\u90a3\u4e48\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u66b4\u529b\uff0c\u904d\u5386\u4e00\u904d\u5b57\u7b26\u4e32\u3002\u6216\u8005\u7528string\u81ea\u5e26\u7684string.find\uff0c\u6ca1\u5565\u597d\u8bf4\u7684\u3002<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>\u5b8c\u6574\u4ee3\u7801\uff08\u66b4\u529b\uff09<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Solution {\npublic:\n    bool checkOnesSegment(string s) {\n        int i=0;\n        for(i=1;s&#91;i]!='\\0';i++)\n            if(s&#91;i]=='0')\n             break;\n        for(;s&#91;i]!='\\0';i++)\n            if(s&#91;i]=='1')\n            return false;\n        return true;\n    }\n};<\/code><\/pre>\n\n\n\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0cstring.find\u51fd\u6570\u5982\u679c\u6ca1\u6709\u627e\u5230\u5bf9\u5e94\u7684\u5b50\u4e32\uff0c\u8fd4\u56de\u7684\u662f\u5e38\u6570npos\u800c\u4e0d\u662fbool\u7c7b\u578b\u7684\u503c\u3002\uff08npos=4294967295\uff09<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>\u5b8c\u6574\u4ee3\u7801\uff08\u81ea\u5e26\u51fd\u6570\uff09<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Solution {\npublic:\n    bool checkOnesSegment(string s) {\n        return s.find(\"01\")==string::npos;\n    }\n};<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>LeetCode\u9898\u76ee\uff1a\u66b4\u529bor\u81ea\u5e26\u51fd\u6570<\/p>\n","protected":false},"author":1,"featured_media":2827,"comment_status":"open","ping_status":"closed","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[42,25],"tags":[38],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/1022"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=1022"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/1022\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/2827"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=1022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=1022"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=1022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}