{"id":311,"date":"2024-04-27T21:40:05","date_gmt":"2024-04-27T13:40:05","guid":{"rendered":"https:\/\/seanxd.com\/?p=311"},"modified":"2024-04-27T21:40:08","modified_gmt":"2024-04-27T13:40:08","slug":"zerojudge-d103","status":"publish","type":"post","link":"https:\/\/seanxd.com\/en\/zerojudge-d103\/","title":{"rendered":"ZeroJudge D103: ISBN Number"},"content":{"rendered":"\n\n\n<p class=\"\">\u6bcf\u4e00\u672c\u6b63\u5f0f\u51fa\u7248\u7684\u5716\u66f8\u90fd\u6709\u4e00\u500b ISBN \u865f\u78bc\u8207\u4e4b\u5c0d\u61c9\uff0cISBN \u78bc\u5305\u62ec 9 \u4f4d\u6578\u5b57\u30011 \u4f4d\u8b58\u5225\u78bc\u548c 3 \u4f4d\u5206\u9694\u7b26\uff0c\u5176\u898f\u5b9a\u683c\u5f0f\u5982\u300cx-xxx-xxxxx-x\u300d\uff0c\u5176\u4e2d\u7b26\u865f\u300c-\u300d\u662f\u5206\u9694\u7b26\u865f (\u9375\u76e4\u4e0a\u7684\u6e1b\u865f\uff09\uff0c\u6700\u5f8c\u4e00\u4f4d\u662f\u8b58\u5225\u78bc\uff0c\u4f8b\u5982 0-670-82162-4 \u5c31\u662f\u4e00\u500b\u6a19\u6e96\u7684 ISBN \u78bc\u3002 ISBN \u78bc\u7684\u9996\u4f4d\u6578\u5b57\u8868\u793a\u66f8\u7c4d\u7684\u51fa\u7248\u8a9e\u8a00\uff0c\u4f8b\u5982 0 \u4ee3\u8868\u82f1\u6587\uff1b\u7b2c\u4e00\u500b\u5206\u9694\u7b26\u865f\u300c-\u300d\u4e4b\u5f8c\u7684\u4e09\u4f4d\u6578\u5b57\u4ee3\u8868\u51fa\u7248\u793e\uff0c\u4f8b\u5982 670 \u4ee3\u8868\u7dad\u4eac\u51fa\u7248\u793e\uff1b\u7b2c\u4e8c\u500b\u5206\u9694\u4e4b\u5f8c\u7684\u4e94\u4f4d\u6578\u5b57\u4ee3\u8868\u8a72\u66f8\u5728\u51fa\u7248\u793e\u7684\u7de8\u865f\uff1b\u6700\u5f8c\u4e00\u4f4d\u70ba\u8b58\u5225\u78bc\u3002<\/p>\n\n\n\n<p class=\"\">\u8b58\u5225\u78bc\u7684\u8a08\u7b97\u65b9\u6cd5\u5982\u4e0b\uff1a<br>\u9996\u4f4d\u6578\u5b57\u4e58\u4ee5 1 \u52a0\u4e0a\u6b21\u4f4d\u6578\u5b57\u4e58\u4ee5 2 \u2026 \u4ee5\u6b64\u985e\u63a8\uff0c\u7528\u6240\u5f97\u7684\u7d50\u679c mod 11\uff0c\u6240\u5f97\u7684\u9918\u6578\u5373\u70ba\u8b58\u5225\u78bc\uff0c\u82e5\u9918\u6578\u70ba 10\uff0c\u5247\u8b58\u5225\u78bc\u70ba\u5927\u5beb\u5b57\u6bcd X\u3002<\/p>\n\n\n\n<p class=\"\">\u4f8b\u5982 ISBN \u865f\u78bc 0-670-82162-4 \u4e2d\u7684\u8b58\u5225\u78bc 4 \u662f\u9019\u6a23\u5f97\u5230\u7684\uff1a\u5c0d 067082162 \u90199\u500b\u6578\u5b57\uff0c\u5f9e\u5de6\u5230\u53f3\uff0c\u5206\u5225\u4e58\u4ee5 1\uff0c2\uff0c\u2026\uff0c9\uff0c\u518d\u6c42\u548c\uff0c\u5373 0 \u00d7 1 + 6 \u00d7 2 + \u2026\u2026 + 2 \u00d7 9 = 158\uff0c\u7136\u5f8c\u53d6 158 mod 11 \u7684\u7d50\u679c 4 \u4f5c\u70ba\u8b58\u5225\u78bc\u3002<\/p>\n\n\n\n<p class=\"\">\u4f60\u7684\u4efb\u52d9\u662f\u7de8\u5beb\u7a0b\u5f0f\u5224\u65b7\u8f38\u5165\u7684 ISBN \u865f\u78bc\u4e2d\u8b58\u5225\u78bc\u662f\u5426\u6b63\u78ba\uff0c\u5982\u679c\u6b63\u78ba\uff0c\u5247\u50c5\u8f38\u51fa\u300cRight\u300d\uff1b\u5982\u679c\u932f\u8aa4\uff0c\u5247\u8f38\u51fa\u4f60\u8a8d\u70ba\u662f\u6b63\u78ba\u7684 ISBN \u865f\u78bc\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><strong>EOF<\/strong> \u8f38\u5165\uff0c\u6bcf\u4e00\u884c\u662f\u4e00\u500b\u5b57\u5143\u5e8f\u5217\uff0c\u8868\u793a\u4e00\u672c\u66f8\u7684 ISBN \u865f\u78bc\uff08\u4fdd\u8b49\u8f38\u5165\u7b26\u5408ISBN\u865f\u78bc\u7684\u683c\u5f0f\u8981\u6c42\uff09\u3002<\/td><td>\u5047\u5982\u8f38\u5165\u7684 ISBN \u865f\u78bc\u7684\u8b58\u5225\u78bc\u6b63\u78ba\uff0c\u90a3\u9ebc\u8f38\u51fa\u300cRight\u300d\uff0c\u5426\u5247\uff0c\u6309\u7167\u898f\u5b9a\u7684\u683c\u5f0f\uff0c\u8f38\u51fa\u6b63\u78ba\u7684ISBN\u865f\u78bc (\u5305\u62ec\u5206\u9694\u7b26\u865f\u300c-\u300d\uff09\u3002<\/td><\/tr><tr><td>0-670-82162-4<br>0-670-82162-0<\/td><td>Right<br>0-670-82162-4<\/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<\/strong> <strong>\u5c07\u6e1b\u865f\u6392\u9664<\/strong>\uff0c\u4e26\u4e14\u5224\u65b7\u8a8d\u8b49\u78bc\u70ba\u4f55\uff0c\u5982\u679c\u9a57\u8b49\u78bc\u548c\u5b57\u4e32\u6700\u5f8c\u4e00\u500b\u5b57\u5143\u76f8\u540c\uff0c\u5247\u8f38\u51fa\u300cRight\u300d\uff0c\u5982\u679c\u4e0d\u76f8\u540c\u5247\u5c07\u6700\u5f8c\u4e00\u500b\u5b57\u5143\u6539\u6210\u6b63\u78ba\u7684\u9a57\u8b49\u78bc\u4e26\u8f38\u51fa\u5b57\u4e32\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=d103\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge D103: ISBN\u865f\u78bc<\/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    string str;\n    while (cin &gt;&gt; str)\n    {\n        string num = &quot;&quot;;\n        int sum = 0;\n        string output = &quot;&quot;;\n        for (int i = 0; i&lt;str.length()-1; i++)\n        {\n            if (str[i] != &#39;-&#39;) num += str[i];\n            output += str[i];\n        }\n        for (int i = 0; i&lt;num.length(); i++)\n        {\n            sum += int(num[i] - &#39;0&#39;) * (i+1);\n        }\n        string ans;\n        if (sum % 11 &lt; 10) ans = to_string(sum % 11);\n        else ans = &quot;X&quot;;\n        if (ans[0] == str[str.length()-1]) cout &lt;&lt; &quot;Right\\n&quot;;\n        else cout &lt;&lt; output &lt;&lt; ans &lt;&lt; &quot;\\n&quot;;\n    }\n}\n\n\/\/ZeroJudge D103\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u6bcf\u4e00\u672c\u6b63\u5f0f\u51fa\u7248\u7684\u5716\u66f8\u90fd\u6709\u4e00\u500b ISBN \u865f\u78bc\u8207\u4e4b\u5c0d\u61c9\uff0cISBN \u78bc\u5305\u62ec 9 \u4f4d\u6578\u5b57\u30011 \u4f4d\u8b58\u5225\u78bc\u548c 3 \u4f4d\u5206\u9694 [&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":[25],"tags":[8,11,12,9],"class_list":["post-311","post","type-post","status-publish","format-standard","hentry","category-ioi-apcs","tag-8","tag-11","tag-12","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/311","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=311"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/311\/revisions"}],"predecessor-version":[{"id":312,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/311\/revisions\/312"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/media?parent=311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/categories?post=311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/tags?post=311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}