{"id":251,"date":"2024-04-26T22:52:08","date_gmt":"2024-04-26T14:52:08","guid":{"rendered":"https:\/\/seanxd.com\/?p=251"},"modified":"2024-04-26T22:52:10","modified_gmt":"2024-04-26T14:52:10","slug":"zerojudge-a866","status":"publish","type":"post","link":"https:\/\/seanxd.com\/en\/zerojudge-a866\/","title":{"rendered":"ZeroJudge A866: Product Review Site"},"content":{"rendered":"\n\n\n<p class=\"\">\u4e00\u500b\u65b0\u6210\u7acb\u7684\u7db2\u62cd\u7db2\u7ad9\u9700\u8981\u4e00\u500b\u6aa2\u95b1\u5546\u54c1\u8a55\u50f9\u7684\u7cfb\u7d71\uff0c\u8a55\u50f9\u5206\u70ba\u4e94\u500b\u7b49\u7d1a\u7531 1~5 \u8868\u793a\uff0c\u7576\u4f7f\u7528\u8005\u641c\u5c0b\u8a72\u5546\u54c1\u6642\u7cfb\u7d71\u5fc5\u9808<strong>\u5c55\u793a\u51fa\u8a72\u5546\u54c1\u7684\u6b77\u53f2\u7d00\u9304<\/strong>\uff0c\u6b77\u53f2\u7d00\u9304<strong>\u5305\u542b\u6240\u6709\u7b49\u7d1a\u7684\u8a55\u50f9\u6b21\u6578\u3001\u9577\u689d\u5716\u4ee5\u53ca\u5e73\u5747\u8a55\u50f9\u7b49\u7d1a<\/strong>\uff0c\u8acb\u5beb\u4e00\u500b\u7a0b\u5f0f\u5354\u52a9\u9019\u500b\u7db2\u7ad9\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\u7b46\u6e2c\u8cc7\u70ba\u4e00\u500b\u5546\u54c1\u7684\u6b77\u53f2\u8a55\u50f9\uff0c\u6bcf\u884c\u5305\u542b\u4e00\u500b\u8a55\u50f9 (1 ~ 5 \u7684\u6574\u6578)\uff0c\u4ee5 0 \u505a\u7d50\u5c3e<\/td><td>\u8f38\u51fa\u5171\u516d\u884c\uff0c\u5206\u5225\u70ba\u8a55\u50f9\u7b49\u7d1a 5 ~ 1 \u7684\u8cc7\u8a0a\uff0c\u6bcf\u884c\u8cc7\u8a0a\u5305\u542b\u8a55\u50f9\u7b49\u7d1a\u3001\u8a55\u50f9\u6b21\u6578 (\u4e0d\u6eff\u5341\u88dc\u7a7a\u767d) \u548c\u9577\u689d\u5716 (\u4ee5\u548c\u8a55\u50f9\u6b21\u6578\u7b49\u91cf\u7684 \u201d=\u201d \u8868\u793a)\uff0c\u6700\u5f8c\u4e00\u884c\u8f38\u51fa\u5e73\u5747\u8a55\u50f9\u7b49\u7d1a (<strong>\u56db\u6368\u4e94\u5165\u81f3\u5c0f\u6578\u9ede\u4ee5\u4e0b\u7b2c\u56db\u4f4d<\/strong>)\uff0c\u8a73\u7d30\u683c\u5f0f\u8acb\u898b\u7bc4\u4f8b\u8f38\u51fa<\/td><\/tr><tr><td>4<br>5<br>3<br>4<br>2<br>4<br>3<br>5<br>2<br>1<br>3<br>2<br>4<br>3<br>2<br>4<br>3<br>3<br>2<br>4<br>3<br>3<br>5<br>3<br>1<br>4<br>3<br>2<br>4<br>5<br>4<br>3<br>4<br>3<br>3<br>4<br>3<br>0<\/td><td>5 ( 4) |====<br>4 (11) |===========<br>3 (14) |==============<br>2 ( 6) |======<br>1 ( 2) |==<br>Average rating: 3.2432<\/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=\"\">\u53ef\u4ee5\u4f7f\u7528 Map \u4f86\u5b58\u653e\u8cc7\u6599\uff0c\u8f38\u51fa\u5e73\u5747\u503c\u7684\u90e8\u4efd\u53ef\u4ee5\u7528 <strong>printf<\/strong> \u7684\u65b9\u5f0f\u4f86\u505a\u53ea\u5230\u7b2c\u56db\u4f4d\u7684\u8f38\u51fa\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=a866\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge A866: Product Review Site<\/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;stdio.h&gt;\n#include &lt;map&gt;\nusing namespace std;\n\nint main() {\n    int N, count = 0;\n    double sum = 0;\n    map&lt;int, int&gt;MAP;\n    while (cin &gt;&gt; N && N != 0)\n    {\n        MAP[N]++;\n        sum += double(N);\n        count++;\n    }\n    map&lt;int, string&gt;result;\n    int maxLen = -999;\n    double avg = sum \/ double(count);\n    for (int i = 5; i&gt;0; i--)\n    {\n        result[i] = to_string(MAP[i]);\n        int len = result[i].length();\n        if (len &gt; maxLen) maxLen = len;\n    }\n    for (int i = 5; i&gt;0; i--)\n    {\n        cout &lt;&lt; i &lt;&lt; &quot; (&quot;;\n        for (int j = result[i].length(); j&lt;maxLen; j++)\n        {\n            cout &lt;&lt; &quot; &quot;;\n        }\n        cout &lt;&lt; MAP[i] &lt;&lt; &quot;) |&quot;;\n        for (int j = 0; j&lt;MAP[i]; j++)\n        {\n            cout &lt;&lt; &quot;=&quot;;\n        }\n        cout &lt;&lt; &quot;\\n&quot;;\n    }\n    printf(&quot;Average rating: %.4f\\n&quot;, avg);\n}\n\n\/\/ZeroJudge A866\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u500b\u65b0\u6210\u7acb\u7684\u7db2\u62cd\u7db2\u7ad9\u9700\u8981\u4e00\u500b\u6aa2\u95b1\u5546\u54c1\u8a55\u50f9\u7684\u7cfb\u7d71\uff0c\u8a55\u50f9\u5206\u70ba\u4e94\u500b\u7b49\u7d1a\u7531 1~5 \u8868\u793a\uff0c\u7576\u4f7f\u7528\u8005\u641c\u5c0b\u8a72\u5546\u54c1\u6642\u7cfb\u7d71\u5fc5\u9808 [&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":[29],"tags":[14,8,7,9],"class_list":["post-251","post","type-post","status-publish","format-standard","hentry","category-zerojudge-","tag-map","tag-8","tag-7","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/251","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=251"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/251\/revisions"}],"predecessor-version":[{"id":252,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/251\/revisions\/252"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/media?parent=251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/categories?post=251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/tags?post=251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}