{"id":334,"date":"2018-10-30T21:48:42","date_gmt":"2018-10-30T13:48:42","guid":{"rendered":"https:\/\/blog.tcreopargh.xyz\/?p=334"},"modified":"2018-11-03T15:49:40","modified_gmt":"2018-11-03T07:49:40","slug":"c-c%e5%8d%81%e8%bf%9b%e5%88%b6%e8%bd%ac%e4%ba%8c%e8%bf%9b%e5%88%b6","status":"publish","type":"post","link":"https:\/\/blog.tcreopargh.xyz\/?p=334","title":{"rendered":"(C\/C++)\u5341\u8fdb\u5236\u8f6c\u4e8c\u8fdb\u5236"},"content":{"rendered":"\n<p>\u9898\u76ee\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.tcreopargh.xyz\/wp-content\/uploads\/2018\/10\/TIM\u56fe\u724720181030214646.png\"><figure class=\"mdx-lazyload-container\" style=\"max-width:1069px\"><div style=\"padding-top:62.020579981291%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"1069\" height=\"663\" class=\"wp-image-335 lazyload\" title=\"(C\/C++)\u5341\u8fdb\u5236\u8f6c\u4e8c\u8fdb\u5236\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/blog.tcreopargh.xyz\/wp-content\/uploads\/2018\/10\/TIM\u56fe\u724720181030214646.png\" alt=\"https:\/\/blog.tcreopargh.xyz\/wp-content\/uploads\/2018\/10\/TIM\u56fe\u724720181030214646.png\" data-srcset=\"https:\/\/blog.tcreopargh.xyz\/wp-content\/uploads\/2018\/10\/TIM\u56fe\u724720181030214646.png 1069w, https:\/\/blog.tcreopargh.xyz\/wp-content\/uploads\/2018\/10\/TIM\u56fe\u724720181030214646-768x476.png 768w\" sizes=\"(max-width: 1069px) 100vw, 1069px\"><\/figure><\/a><\/figure>\n\n\n\n\n<div class=\"codecolorer-container c default\" style=\"overflow:auto;white-space:nowrap;width:958px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/>18<br \/>19<br \/>20<br \/>21<br \/>22<br \/>23<br \/>24<br \/>25<br \/><\/div><\/td><td><div class=\"c codecolorer\"><span class=\"co1\">\/\/Powered by TCreopargh<\/span><br \/>\n<span class=\"co2\">#include&lt;stdio.h&gt;<\/span><br \/>\n<span class=\"kw4\">int<\/span> main<span class=\"br0\">&#40;<\/span><span class=\"kw4\">int<\/span> argc<span class=\"sy0\">,<\/span> <span class=\"kw4\">char<\/span> <span class=\"sy0\">*<\/span>argv<span class=\"br0\">&#91;<\/span><span class=\"br0\">&#93;<\/span><span class=\"br0\">&#41;<\/span><br \/>\n<span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"kw4\">char<\/span> binRev<span class=\"br0\">&#91;<\/span><span class=\"nu0\">32<\/span><span class=\"br0\">&#93;<\/span><span class=\"sy0\">,<\/span>bin<span class=\"br0\">&#91;<\/span><span class=\"nu0\">32<\/span><span class=\"br0\">&#93;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"kw4\">int<\/span> dec<span class=\"sy0\">,<\/span>i<span class=\"sy0\">=<\/span><span class=\"nu0\">0<\/span><span class=\"sy0\">,<\/span>j<span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; <a href=\"http:\/\/www.opengroup.org\/onlinepubs\/009695399\/functions\/scanf.html\"><span class=\"kw3\">scanf<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;%d&quot;<\/span><span class=\"sy0\">,&amp;<\/span>dec<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"kw1\">if<\/span><span class=\"br0\">&#40;<\/span><span class=\"sy0\">!<\/span>dec<span class=\"br0\">&#41;<\/span> <br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <a href=\"http:\/\/www.opengroup.org\/onlinepubs\/009695399\/functions\/puts.html\"><span class=\"kw3\">puts<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;0&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">return<\/span> <span class=\"nu0\">0<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"kw1\">while<\/span><span class=\"br0\">&#40;<\/span>dec<span class=\"sy0\">&gt;<\/span><span class=\"nu0\">1<\/span><span class=\"br0\">&#41;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; binRev<span class=\"br0\">&#91;<\/span>i<span class=\"br0\">&#93;<\/span><span class=\"sy0\">=<\/span>dec<span class=\"sy0\">%<\/span><span class=\"nu19\">2<\/span><span class=\"sy0\">+<\/span><span class=\"st0\">'0'<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; dec<span class=\"sy0\">\/=<\/span><span class=\"nu0\">2<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; i<span class=\"sy0\">++;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span> &nbsp; <br \/>\n&nbsp; &nbsp; <span class=\"kw1\">if<\/span><span class=\"br0\">&#40;<\/span>dec<span class=\"br0\">&#41;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; binRev<span class=\"br0\">&#91;<\/span>i<span class=\"br0\">&#93;<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">'1'<\/span><span class=\"sy0\">,<\/span>i<span class=\"sy0\">++;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"kw1\">for<\/span><span class=\"br0\">&#40;<\/span>j<span class=\"sy0\">=<\/span>i<span class=\"sy0\">;<\/span>j<span class=\"sy0\">&gt;=<\/span><span class=\"nu0\">0<\/span><span class=\"sy0\">;<\/span>j<span class=\"sy0\">--<\/span><span class=\"br0\">&#41;<\/span> &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; bin<span class=\"br0\">&#91;<\/span>i<span class=\"sy0\">-<\/span>j<span class=\"br0\">&#93;<\/span><span class=\"sy0\">=<\/span>binRev<span class=\"br0\">&#91;<\/span>j<span class=\"sy0\">-<\/span><span class=\"nu0\">1<\/span><span class=\"br0\">&#93;<\/span><span class=\"sy0\">;<\/span> <br \/>\n&nbsp; &nbsp; <a href=\"http:\/\/www.opengroup.org\/onlinepubs\/009695399\/functions\/puts.html\"><span class=\"kw3\">puts<\/span><\/a><span class=\"br0\">&#40;<\/span>bin<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"kw1\">return<\/span> <span class=\"nu0\">0<\/span><span class=\"sy0\">;<\/span> <br \/>\n<span class=\"br0\">&#125;<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>\u9898\u76ee\u5982\u4e0b\uff1a 12345678910111213141516171819202122232425\/\/Powere [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":217,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2,28,7,10],"tags":[37,45,42,16,38],"_links":{"self":[{"href":"https:\/\/blog.tcreopargh.xyz\/index.php?rest_route=\/wp\/v2\/posts\/334"}],"collection":[{"href":"https:\/\/blog.tcreopargh.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.tcreopargh.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.tcreopargh.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.tcreopargh.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=334"}],"version-history":[{"count":3,"href":"https:\/\/blog.tcreopargh.xyz\/index.php?rest_route=\/wp\/v2\/posts\/334\/revisions"}],"predecessor-version":[{"id":350,"href":"https:\/\/blog.tcreopargh.xyz\/index.php?rest_route=\/wp\/v2\/posts\/334\/revisions\/350"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.tcreopargh.xyz\/index.php?rest_route=\/wp\/v2\/media\/217"}],"wp:attachment":[{"href":"https:\/\/blog.tcreopargh.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.tcreopargh.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.tcreopargh.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}