{"id":234,"date":"2024-04-26T21:48:56","date_gmt":"2024-04-26T13:48:56","guid":{"rendered":"https:\/\/seanxd.com\/?p=234"},"modified":"2024-04-26T21:48:58","modified_gmt":"2024-04-26T13:48:58","slug":"zerojudge-a536","status":"publish","type":"post","link":"https:\/\/seanxd.com\/en\/zerojudge-a536\/","title":{"rendered":"ZeroJudge A536: Soda Surpler"},"content":{"rendered":"<h4 class=\"wp-block-heading\">UVa 11689 \u2013 Soda Surpler<\/h4>\n\n\n\n<p class=\"translation-block\">Tim is a person who loves to drink soda very much. Since he doesn't have money, the only way he can drink soda is by collecting empty soda bottles and then taking them to recycle for money to buy new soda to drink. In addition to the empty bottles he drinks himself, Tim also goes out to collect empty bottles that others have finished drinking. One day, he is very thirsty, and he wants to drink as much soda as possible until he can't get any more bottles.<\/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>The first line of input contains an integer N, indicating how many sets of test data follow.<br>Each set of test data consists of a single line containing three integers: E, F, and C. E (0 &lt;= E &lt; 1000) represents the number of empty bottles Tim initially has, F (0 &lt;= F &lt; 1000) represents the number of empty bottles Tim collects from the street on that day, and C (1 &lt; C &lt; 2000) represents how many empty bottles can be exchanged for a new bottle of soda.<\/td><td>For each set of test data, output a single line representing how many bottles of soda Tim can drink.<\/td><\/tr><tr><td>2<br>9  0  3<br>5  5  2<\/td><td>4<br>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\">You can use a while loop to make the check each time. The initial value of all empty bottles is E+F. It's important to note that after exchanging for a bottle of soda, one empty bottle is consumed, so the count of empty bottles should increase by 1.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sample Code\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=a536\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge A536: Soda Surpler<\/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 N;\n    cin &gt;&gt; N;\n    for (int i = 0; i&lt;N; i++)\n    {\n        int E, F, C;\n        cin &gt;&gt; E &gt;&gt; F &gt;&gt; C;\n        int total = E+F;\n        int ans = 0;\n        while (total &gt;= C)\n        {\n            total -= C;\n            total++;\n            ans++;\n        }\n        cout &lt;&lt; ans &lt;&lt; &quot;\\n&quot;;\n    }\n}\n\n\/\/ZeroJudge A536\n\/\/Dr. SeanXD<\/code><\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>\u540c\u984c\uff1aUVa 11689 &#8211; Soda Surpler Tim \u662f\u4e00\u500b\u975e\u5e38\u611b\u559d\u6c7d\u6c34\u7684\u4eba\u3002\u7531\u65bc\u4ed6\u6c92\u6709 [&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":[18],"tags":[13,9],"class_list":["post-234","post","type-post","status-publish","format-standard","hentry","category-uva","tag-13","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/234","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=234"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/234\/revisions"}],"predecessor-version":[{"id":235,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/234\/revisions\/235"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/media?parent=234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/categories?post=234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/tags?post=234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}