{"id":449,"date":"2024-05-03T16:30:53","date_gmt":"2024-05-03T08:30:53","guid":{"rendered":"https:\/\/seanxd.com\/?p=449"},"modified":"2024-05-03T16:30:55","modified_gmt":"2024-05-03T08:30:55","slug":"zerojudge-c203","status":"publish","type":"post","link":"https:\/\/seanxd.com\/zh\/zerojudge-c203\/","title":{"rendered":"ZeroJudge C203: DPA Numbers I"},"content":{"rendered":"\n\n\n<h4 class=\"wp-block-heading\">\u540c\u984c\uff1aUVa 13185 &#8211; DPA Numbers I<\/h4>\n\n\n\n<p class=\"\">\u4e00\u500b\u6574\u6578 B \u5982\u679c\u53ef\u4ee5\u88ab\u53e6\u4e00\u500b\u6574\u6578 A \u6574\u9664 (\u5728\u9019\u88e1 A > B\uff09\uff0c\u6211\u5011\u7a31 B \u662f A \u7684\u4e00\u500b\u56e0\u6578\u3002<\/p>\n\n\n\n<p class=\"\">Perfect Number \u662f\u4e00\u500b\u6b63\u6574\u6578\u4e26\u4e14\u7b49\u65bc\u5176\u6240\u6709\u56e0\u6578 (\u4e0d\u5305\u542b\u5b83\u81ea\u5df1) \u7684\u548c\u3002<\/p>\n\n\n\n<p class=\"\">\u4f8b\u5982\uff1a6 \u548c 28 \u90fd\u662f Perfect Number\u3002\u56e0\u70ba 6 = 1 + 2 + 3\uff0c28 = 1 + 2 + 4 + 7 + 14\u3002<\/p>\n\n\n\n<p class=\"\">\u5982\u679c\u4e00\u500b\u6b63\u6574\u6578\u4e0d\u662f Perfect\uff0c\u90a3\u4ed6\u5c31\u662f Deficient \u6216\u8005\u662f Abundant\uff0c\u6839\u64da\u5176\u6240\u6709\u56e0\u6578\u7684\u548c\u662f\u5c0f\u65bc\u6216\u5927\u65bc\u9019\u500b\u6578\u672c\u8eab\u3002\u56e0\u6b64\uff0c9 \u662f Deficient \u56e0\u70ba 1 + 3 &lt; 9\u3002\u800c 12 \u662f Abundant \u56e0\u70ba 1 + 2 + 3 + 4 + 6 > 12\u3002<\/p>\n\n\n\n<p class=\"\">\u8acb\u5beb\u4e00\u500b\u7a0b\u5f0f\u6c42\u51fa\u67d0\u4e00\u500b\u6578\u662f Perfect\u3001Deficient\u3001\u6216\u8005 Abundant\u3002<\/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>\u8f38\u5165\u7684\u7b2c\u4e00\u5217\u6709\u4e00\u500b\u6b63\u6574\u6578t\u4ee3\u8868\u4ee5\u4e0b\u6709\u5e7e\u7b46\u6e2c\u8cc7\u3002\uff081 &lt;= T &lt;= 500\uff09<br>\u6bcf\u7b46\u6e2c\u8cc7\u4e00\u5217\uff0c\u6709\u4e00\u500b\u6b63\u6574\u6578 N\uff082 &lt;= N &lt;= 1000\uff09<\/td><td>\u5c0d\u6bcf\u7b46\u6e2c\u8cc7\u8f38\u51fa\u4e00\u5217\uff0c\u8f38\u51fa N \u662f Perfect\u3001Deficient\u3001\u6216\u8005 Abundant\u3002<\/td><\/tr><tr><td>10<br>5<br>6<br>16<br>18<br>21<br>28<br>29<br>30<br>40<br>43<\/td><td>deficient<br>perfect<br>deficient<br>abundant<br>deficient<br>perfect<br>deficient<br>abundant<br>abundant<br>deficient<\/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=\"\">\u4f7f\u7528 <strong>For\u8ff4\u5708 \u5224\u65b7\u6bcf\u4e00\u500b\u6578\u5b57\u7684\u56e0\u6578<\/strong>\uff0c\u5982\u679c N \u9664\u4ee5\u76ee\u524d\u8ff4\u5708\u8dd1\u5230\u7684\u6578\u5b57 (i) \u4e4b\u9918\u6578\u7b49\u65bc0\uff0ci \u5c31\u662fN\u7684\u56e0\u6578\u3002\u9032\u884c\u52a0\u7e3d\u4e4b\u5f8c\u5224\u65b7\u662f\u5c0f\u65bc\u3001\u7b49\u65bc\u3001\u9084\u662f\u5927\u65bc\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=c203\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge C203: DPA Numbers I<\/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;\nusing namespace std;\n\nint main() {\n    cin.sync_with_stdio(0);\n    cin.tie(0);\n    int T;\n    cin &gt;&gt; T;\n    for (int i = 0; i&lt;T; i++)\n    {\n        int N;\n        cin &gt;&gt; N;\n        int count = 0;\n        for (int j = 1; j&lt;N; j++)\n        {\n            if (N % j == 0)\n            {\n                count += j;\n            }\n        }\n        if (count == N) cout &lt;&lt; &quot;perfect\\n&quot;;\n        else if (count &gt; N) cout &lt;&lt; &quot;abundant\\n&quot;;\n        else cout &lt;&lt; &quot;deficient\\n&quot;;\n    }\n}\n\n\/\/ZeroJudge C203\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u540c\u984c\uff1aUVa 13185 &#8211; DPA Numbers I \u4e00\u500b\u6574\u6578 B \u5982\u679c\u53ef\u4ee5\u88ab\u53e6\u4e00\u500b\u6574\u6578 A  [&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":[18],"tags":[8,13,9],"class_list":["post-449","post","type-post","status-publish","format-standard","hentry","category-uva","tag-8","tag-13","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/449","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/comments?post=449"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/449\/revisions"}],"predecessor-version":[{"id":450,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/449\/revisions\/450"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/media?parent=449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/categories?post=449"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/tags?post=449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}