{"id":256,"date":"2024-04-26T23:08:29","date_gmt":"2024-04-26T15:08:29","guid":{"rendered":"https:\/\/seanxd.com\/?p=256"},"modified":"2024-04-26T23:08:31","modified_gmt":"2024-04-26T15:08:31","slug":"zerojudge-b971","status":"publish","type":"post","link":"https:\/\/seanxd.com\/en\/zerojudge-b971\/","title":{"rendered":"ZeroJudge B971: Arithmetic Sequence"},"content":{"rendered":"<p class=\"translation-block\">Given the <strong>first term, last term, and common difference<\/strong> of an arithmetic sequence, please <strong>output this arithmetic sequence<\/strong>.<\/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 Input(s)<\/th><th>Sample Output(s)<\/th><\/tr><\/thead><tbody><tr><td class=\"translation-block\">The input consists of only one line containing three integers: the <strong>first term, last term, and common difference<\/strong> of the arithmetic sequence.<\/td><td class=\"translation-block\">Output the <strong>arithmetic sequence<\/strong>, with each term separated by a space.<\/td><\/tr><tr><td>1  9  2<\/td><td>1  3  5  7  9<\/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 <strong>while loop<\/strong> with the <strong>termination condition being the starting point equal to the end point<\/strong>. Avoid using less than as the termination condition because negative numbers may be present.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sample Code\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=b971\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge B971: Arithmetic Sequence<\/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 start, finish, change;\n    cin &gt;&gt; start &gt;&gt; finish &gt;&gt; change;\n    while (start != finish)\n    {\n        cout &lt;&lt; start &lt;&lt; &quot; &quot;;\n        start += change;\n    }\n    cout &lt;&lt; start &lt;&lt; &quot;\\n&quot;;\n}\n\n\/\/Z.O.J. B971\n\/\/Dr. SeanXD<\/code><\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>\u7d66\u4f60\u4e00\u500b\u7b49\u5dee\u6578\u5217\u7684\u9996\u9805\u3001\u672b\u9805\u548c\u516c\u5dee\uff0c\u8acb\u8f38\u51fa\u9019\u500b\u7b49\u5dee\u6578\u5217\u3002 \u7bc4\u4f8b\u6e2c\u8cc7 \u7bc4\u4f8b\u8f38\u5165 \u7bc4\u4f8b\u8f38\u51fa \u8f38\u5165\u53ea\u6709\u4e00\u884c\uff0c\u5305\u542b\u9996\u9805 [&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":[13,9],"class_list":["post-256","post","type-post","status-publish","format-standard","hentry","category-6","tag-13","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/256","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=256"}],"version-history":[{"count":2,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/256\/revisions"}],"predecessor-version":[{"id":258,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/256\/revisions\/258"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/media?parent=256"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/categories?post=256"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/tags?post=256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}