{"id":295,"date":"2024-04-27T12:37:49","date_gmt":"2024-04-27T04:37:49","guid":{"rendered":"https:\/\/seanxd.com\/?p=295"},"modified":"2024-04-27T12:37:51","modified_gmt":"2024-04-27T04:37:51","slug":"zerojudge-c562","status":"publish","type":"post","link":"https:\/\/seanxd.com\/en\/zerojudge-c562\/","title":{"rendered":"ZeroJudge C562: Puyu Loves Numeral Theory"},"content":{"rendered":"\n\n\n<p class=\"\">\u5c0d\u65bc\u7cbe\u901a\u6578\u8ad6\u984c\u76ee\u7684 Puyu\uff0c\u865f\u7a31\u6c92\u6709\u6578\u8ad6\u984c\u76ee\u662f\u4ed6\u89e3\u4e0d\u51fa\u4f86\u7684\u3002\u65bc\u662f\u64c5\u9577\u51fa\u5947\u602a\u6c34\u984c\u7684 CTF \u5f9e\u5929\u4e0a\u964d\u81e8\u5230\u4e86\u4eba\u9593\u6e96\u5099\u8ddf\u4ed6\u4f86\u4e00\u8f03\u9ad8\u4e0b\u3002<\/p>\n\n\n\n<p class=\"\">CTF \u7d66 Puyu \u5e7e\u7d44\u6578\u5b57\uff0c\u5206\u5225\u4ee3\u8868\u51fd\u6578\u5e36\u9032\u53bb\u7684\u503c\u8207\u51fd\u6578\u7d50\u679c\uff0c\u8acb\u4ed6\u627e\u51fa\u5176\u4e2d\u7684\u898f\u5f8b\uff0c\u4e26\u56de\u7b54 CTF \u554f\u7684\u4e00\u4e9b\u6578\u5b57\u6703\u7522\u751f\u7684\u7d50\u679c\u3002<\/p>\n\n\n\n<p class=\"\">\u51fd\u6578\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"\">F ( 110 ) = 1<\/li>\n\n\n\n<li class=\"\">F ( 163 ) = 1<\/li>\n\n\n\n<li class=\"\">F ( 223 ) = 0<\/li>\n\n\n\n<li class=\"\">F ( 119 ) = 1<\/li>\n\n\n\n<li class=\"\">F ( 278 ) = 2<\/li>\n\n\n\n<li class=\"\">F ( 821 ) = 2<\/li>\n<\/ul>\n\n\n\n<p class=\"\">\u73fe\u5728\u8acb\u4f60<strong>\u89c0\u5bdf\u51fd\u6578\u898f\u5f8b<\/strong>\uff0c\u4e26\u5beb\u500b\u7a0b\u5f0f\u4f86\u5e6b\u52a9 Puyu \u4f86\u5b8c\u6210\u6311\u6230\uff01<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7bc4\u4f8b\u6e2c\u8cc7<\/h2>\n\n\n\n<figure class=\"wp-block-table nfd-wb-animate nfd-wb-fade-in-bottom-short\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7bc4\u4f8b\u8f38\u5165<\/th><th>\u7bc4\u4f8b\u8f38\u51fa<\/th><\/tr><\/thead><tbody><tr><td><strong>EOF<\/strong> \u8f38\u5165\uff0c\u6bcf\u7b46\u6e2c\u8cc7\u6709\u4e00\u500b\u6578\u5b57 N \uff0c\u4ee3\u8868 CTF \u554f Puyu \u7684\u6578\u5b57\u3002<br>( 0 &lt;= N &lt;= 2147483649 )<\/td><td>\u6bcf\u884c\u8acb\u8f38\u51fa\u4e00\u500b\u6578 F ( N )\u3002<br><strong>F ( N ) \u5fc5\u5728 int \u7bc4\u570d<\/strong>\u3002<\/td><\/tr><tr><td>223<br>821<br>734<\/td><td>0<br>2<br>0<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u984c\u601d\u8def<\/h2>\n\n\n\n<p class=\"\">\u672c\u984c\u662f\u8003 N \u4e2d\u6bcf\u4e00\u500b\u6578\u5b57\u6709\u591a\u5c11\u500b\u6d1e\uff0c\u8209\u4f8bf(0)\u6703\u662f1\u3001f(8)\u6703\u662f2\u3002\u53ef\u4ee5\u4f7f\u7528<strong>\u5b57\u4e32\u5c07 N \u9032\u884c\u8f38\u5165<\/strong>\u4e4b\u5f8c\u4f7f\u7528 <strong>If<\/strong> \u4f86\u5224\u65b7\uff0c\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\u4e2d\u662f\u4f7f\u7528 <strong>Map<\/strong> \u4f86\u505a\u5224\u65b7\u9019\u6a23\u53ef\u4ee5<strong>\u76f4\u63a5\u5c07 F(N) \u76f4\u63a5\u52a0\u5230\u7b54\u6848<\/strong>\u4e2d\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=c562\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge C562: Puyu \u611b\u6578\u8ad6<\/a><\/h3>\n\n\n\n<div class=\"hcb_wrap nfd-wb-animate nfd-wb-reveal-right nfd-delay-50\"><pre class=\"prism line-numbers lang-cpp\" data-lang=\"C++\"><code>#include &lt;iostream&gt;\n#include &lt;map&gt;\nusing namespace std;\n\nint main() {\n    map&lt;char, int&gt;MAP;\n    MAP[&#39;0&#39;] = 1;\n    MAP[&#39;6&#39;] = 1;\n    MAP[&#39;8&#39;] = 2;\n    MAP[&#39;9&#39;] = 1;\n    string N;\n    while (cin &gt;&gt; N)\n    {\n        int ans = 0;\n        for (int i = 0; i&lt;N.length(); i++)\n        {\n            ans += MAP[N[i]];\n        }\n        cout &lt;&lt; ans &lt;&lt; &quot;\\n&quot;;\n    }\n}\n\n\/\/ZeroJudge C562\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5c0d\u65bc\u7cbe\u901a\u6578\u8ad6\u984c\u76ee\u7684 Puyu\uff0c\u865f\u7a31\u6c92\u6709\u6578\u8ad6\u984c\u76ee\u662f\u4ed6\u89e3\u4e0d\u51fa\u4f86\u7684\u3002\u65bc\u662f\u64c5\u9577\u51fa\u5947\u602a\u6c34\u984c\u7684 CTF \u5f9e\u5929\u4e0a\u964d\u81e8\u5230\u4e86\u4eba\u9593 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[6],"tags":[14,11,9],"class_list":["post-295","post","type-post","status-publish","format-standard","hentry","category-6","tag-map","tag-11","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/comments?post=295"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/295\/revisions"}],"predecessor-version":[{"id":296,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/295\/revisions\/296"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/media?parent=295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/categories?post=295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/tags?post=295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}