{"id":316,"date":"2024-04-27T22:27:34","date_gmt":"2024-04-27T14:27:34","guid":{"rendered":"https:\/\/seanxd.com\/?p=316"},"modified":"2024-04-27T22:27:36","modified_gmt":"2024-04-27T14:27:36","slug":"zerojudge-f707","status":"publish","type":"post","link":"https:\/\/seanxd.com\/en\/zerojudge-f707\/","title":{"rendered":"ZeroJudge F707: Lucky Seven"},"content":{"rendered":"<p class=\"\">Xiao-Dong likes to travel to various places. One day, while adventuring in a jungle, he discovered an unknown village. He found that the numbers in this village were quite special, so he decided to study them.<\/p>\n\n\n\n<p class=\"\">This village considers 7 to be a very auspicious number, so their number comparisons revolve around 7.<\/p>\n\n\n\n<p class=\"\">If there are two numbers, then between the two numbers:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"translation-block\"><strong>The number that can be divided by 7 is considered larger<\/strong>, for example, 140 is larger than 52.<\/li>\n\n\n\n<li class=\"translation-block\"><strong>Among the numbers that can be divided by 7, the one with the larger remainder when divided by 70 is considered larger<\/strong>, for example, 28 is larger than 14.<\/li>\n\n\n\n<li class=\"translation-block\"><strong>Among the numbers that cannot be divided by 7, the one with the smaller remainder when divided by 77 is considered larger<\/strong>, for example, 15 is larger than 16 and 68.<\/li>\n<\/ul>\n\n\n\n<p class=\"\">Now Xiao-Dong will give you some numbers. Please help Xiao-Dong find the largest number.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Sample Inputs\/Outputs<\/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>Sample Inputs\/Outputs<\/th><th>Sample Inputs\/Outputs<\/th><\/tr><\/thead><tbody><tr><td><strong>EOF<\/strong> inputs: the numbers range between 1 and 100000, and the number 0 indicates the end of the sequence.<br>There are at most 10 numbers, and 0 is not included in the list to be compared.<\/td><td class=\"translation-block\">According to the village's rules for comparing numbers, output the largest number in the given sequence. <strong>If there are multiple largest numbers, please output the first one<\/strong>.<\/td><\/tr><tr><td>7  14  28  0<\/td><td>28<\/td><\/tr><tr><td>7  77  777  0<\/td><td>7<\/td><\/tr><tr><td>52  140  0<\/td><td>140<\/td><\/tr><tr><td>15  16  68  0<\/td><td>15<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Thought Process<\/h2>\n\n\n\n<p class=\"translation-block\">The first received number can be stored in a <strong>Max variable<\/strong>, and then <strong>EOF can be done later<\/strong>. <strong>Compare one by one with the Max variable<\/strong>, and when <strong>comparing the size of remainders<\/strong>, use greater than or equal to or less than or equal to, so that the <strong>previous numbers can be set as the current maximum value<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sample Code\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=f707\" target=\"_blank\" rel=\"noopener\">ZeroJudge F707: Lucky Seven<\/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    int N, max;\n    cin &gt;&gt; max;\n    while (cin &gt;&gt; N && N != 0)\n    {\n        if (max % 7 != 0 && N % 7 == 0) max = N;\n        else if (max % 7 == 0 && N % 7 != 0) continue;\n        else if (max % 7 == 0 && N % 7 == 0)\n        {\n            if (max % 70 &gt;= N % 70) continue;\n            else max = N;\n        }\n        else\n        {\n            if (max % 77 &lt;= N % 77) continue;\n            else max = N;\n        }\n    }\n    cout &lt;&lt; max &lt;&lt; &quot;\\n&quot;;\n}\n\n\/\/ZeroJudge F707\n\/\/Dr. SeanXD<\/code><\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>\u5c0f\u6771\u559c\u6b61\u5230\u5404\u5730\u53bb\u65c5\u904a,\u6709\u4e00\u5929\u4ed6\u5728\u4e00\u8655\u53e2\u6797\u4e2d\u5192\u96aa\u6642\uff0c\u767c\u73fe\u4e86\u4e00\u500b\u4e0d\u77e5\u540d\u7684\u6751\u843d\uff0c\u4ed6\u767c\u73fe\u9019\u500b\u6751\u843d\u4e2d\u7684\u6578\u5b57\u6bd4\u8f03\u76f8\u7576\u7279\u6b8a\uff0c [&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,13],"class_list":["post-316","post","type-post","status-publish","format-standard","hentry","category-ioi-apcs","tag-8","tag-13"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/316","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=316"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/316\/revisions"}],"predecessor-version":[{"id":317,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/316\/revisions\/317"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/media?parent=316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/categories?post=316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/tags?post=316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}