{"id":86,"date":"2025-02-16T23:10:17","date_gmt":"2025-02-16T15:10:17","guid":{"rendered":"https:\/\/liyongquan.cn\/?p=86"},"modified":"2025-02-17T13:06:38","modified_gmt":"2025-02-17T05:06:38","slug":"cf1005-div2-a","status":"publish","type":"post","link":"https:\/\/liyongquan.cn\/?p=86","title":{"rendered":"cf1005.div2.A"},"content":{"rendered":"\n<p><a href=\"https:\/\/codeforces.com\/contest\/2064\/problem\/A\">https:\/\/codeforces.com\/contest\/2064\/problem\/A<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:16px\"><code>#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\nint t,x,flag,ll;\nstring n;\nint main(){\n\t\/\/freopen(\"in.txt\",\"r\",stdin); \n\t\/\/freopen(\"out.txt\",\"w\",stdout); \n\tcin&gt;&gt;t;\n\twhile(t--){\n\t\tcin&gt;&gt;ll&gt;&gt;n;\n\t\tfor(int i=n.size()-1;i&gt;=0;i--){\n\t\t\tif(n&#91;i]=='1'&amp;&amp;flag==0){\n\t\t\t\tx++;flag=1;\n\t\t\t\tif(i!=n.size()-1&amp;&amp;n&#91;i+1]=='0'){x++;}\n\t\t\t}\n\t\t\tif(n&#91;i]=='0'){flag=0;}\n\t\t\n\t\t}\n\t\tcout&lt;&lt;x&lt;&lt;endl;\n\t\tx=0;flag=0;\n\t}\n\t\n\treturn 0;\n}<\/code><\/pre>\n\n\n\n<p>10min\uff0c\u6162\u4e86<\/p>\n\n\n\n<p>\u6ce8\u610f\u5230\uff0c\u82e5\u5b58\u5728\u8fde\u7eed\u20181\u2019\u4e0e\u20180\u2019\u76f8\u90bb\u4e14\u4e3a\u524d\u540e\u5173\u7cfb\u65f6\uff0c\u5fc5\u5b9a\u64cd\u4f5c\u4e24\u6b21\uff0c\u5355\u72ec\u20180\u2019\u4e0d\u64cd\u4f5c\uff0c\u5355\u72ec\u20181\u2019\u64cd\u4f5c1\u6b21<\/p>\n\n\n\n<p>int ll\u7eaf\u4e3a\u4e86\u8df3\u8fc7\u5b57\u7b26\u4e32\u957f\u5ea6\u7684\u8f93\u5165\uff0c\u56e0\u4e3a\u6211\u6ca1\u8bfb\u9898\uff0c\u76f4\u63a5n.size()\u53d6\u957f\u5ea6\u4e86<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/codeforces.com\/contest\/2064\/problem\/A 10min\uff0c\u6162\u4e86  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-86","post","type-post","status-publish","format-standard","hentry","category-4"],"_links":{"self":[{"href":"https:\/\/liyongquan.cn\/index.php?rest_route=\/wp\/v2\/posts\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/liyongquan.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/liyongquan.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/liyongquan.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/liyongquan.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=86"}],"version-history":[{"count":3,"href":"https:\/\/liyongquan.cn\/index.php?rest_route=\/wp\/v2\/posts\/86\/revisions"}],"predecessor-version":[{"id":92,"href":"https:\/\/liyongquan.cn\/index.php?rest_route=\/wp\/v2\/posts\/86\/revisions\/92"}],"wp:attachment":[{"href":"https:\/\/liyongquan.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/liyongquan.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/liyongquan.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}