{"id":174,"date":"2024-04-26T16:18:50","date_gmt":"2024-04-26T08:18:50","guid":{"rendered":"https:\/\/seanxd.com\/?p=174"},"modified":"2024-04-26T16:18:52","modified_gmt":"2024-04-26T08:18:52","slug":"zerojudge-a147","status":"publish","type":"post","link":"https:\/\/seanxd.com\/en\/zerojudge-a147\/","title":{"rendered":"ZeroJudge A147: Print it all"},"content":{"rendered":"<p class=\"\">Greater than 0, integers, not divisible by 7, less than N, please output all possible numbers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Sample Inputs\/Outputs<\/h2>\n\n\n\n<figure style=\"font-size:clamp(14px, 0.875rem + ((1vw - 3.2px) * 0.156), 16px);\" class=\"wp-block-table nfd-wb-animate nfd-wb-fade-in-bottom-short\"><table class=\"has-fixed-layout\"><thead><tr><th>Sample Input(s)<\/th><th>Sample Output(s)<\/th><\/tr><\/thead><tbody><tr><td><strong>EOF<\/strong> inputs: each line contains an integer N, where N is no greater than 10000.<br>If N = 0, it indicates the end of the input data.<\/td><td>The output should be as described earlier, with each number separated by a single space.<\/td><\/tr><tr><td>5<br>10<br>20<br>0<\/td><td>1  2  3  4<br>1  2  3  4  5  6  8  9<br>1  2  3  4  5  6  8  9  10  11  12  13  15  16  17  18  19<\/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\">Use a for loop to iterate through the numbers, and check if the current number is divisible by 7. If it's not, output the number; otherwise, continue to the next iteration.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sample Code\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=a147\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge A147: Print it all<\/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;\n  while (cin &gt;&gt; N)\n    {\n      if (N == 0) break;\n      else\n      {\n        for (int i = 1; i&lt;N; i++)\n          {\n            if (i % 7 != 0) cout &lt;&lt; i &lt;&lt; &quot; &quot;;\n          }\n      }\n      cout &lt;&lt; &quot;\\n&quot;;\n    }\n}\n\n\/\/ZeroJudge A147\n\/\/Dr. SeanXD<\/code><\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>\u5927\u65bc 0\u3001\u6574\u6578\u3001\u4e0d\u53ef\u4ee5\u88ab 7 \u6574\u9664\u3001\u5c0f\u65bc N\uff0c\u8acb\u8f38\u51fa\u6240\u6709\u53ef\u80fd\u7684\u6578\u5b57\u3002 \u7bc4\u4f8b\u6e2c\u8cc7 \u7bc4\u4f8b\u8f38\u5165 \u7bc4\u4f8b\u8f38\u51fa EOF \u8f38 [&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":[8,13,9],"class_list":["post-174","post","type-post","status-publish","format-standard","hentry","category-6","tag-8","tag-13","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/174","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=174"}],"version-history":[{"count":2,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/174\/revisions"}],"predecessor-version":[{"id":176,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/174\/revisions\/176"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/media?parent=174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/categories?post=174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/tags?post=174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}