{"id":451,"date":"2024-05-03T16:45:51","date_gmt":"2024-05-03T08:45:51","guid":{"rendered":"https:\/\/seanxd.com\/?p=451"},"modified":"2024-05-03T16:45:53","modified_gmt":"2024-05-03T08:45:53","slug":"zerojudge-d659","status":"publish","type":"post","link":"https:\/\/seanxd.com\/en\/zerojudge-d659\/","title":{"rendered":"ZeroJudge D659: Cost Cutting"},"content":{"rendered":"\n\n\n<h4 class=\"wp-block-heading\">\u540c\u984c\uff1aUVa 11727 &#8211; Cost Cutting<\/h4>\n\n\n\n<p class=\"\">XYZ\u80a1\u4efd\u6709\u9650\u516c\u53f8\u88ab\u5de8\u5927\u7684\u91d1\u878d\u6d77\u562f\u8972\u64ca\u800c\u5fc5\u9808\u5f97\u6e1b\u5c11\u652f\u51fa\uff0c\u9019\u4e9b\u63aa\u65bd\u5305\u62ec\u7e2e\u5c0f\u8fa6\u516c\u7a7a\u9593\u3001\u958b\u653e\u8cc7\u6e90\u3001\u524a\u6e1b\u734e\u52f5\u3001\u6e1b\u5c11\u5962\u4f88\u54c1\u7684\u958b\u92b7\u4ee5\u53ca\u88c1\u54e1\u3002<\/p>\n\n\n\n<p class=\"\">\u73fe\u5728\u9019\u5bb6\u516c\u53f8\u6709 3 \u4f4d\u54e1\u5de5\uff0c\u800c\u73fe\u5728\u516c\u53f8\u8981\u88c1\u6389\u5176\u4e2d 2 \u500b\u3002\u7d93\u904e\u4e00\u9023\u4e32\u7684\u9762\u8ac7\uff0c<strong>\u516c\u53f8\u5e0c\u671b\u88c1\u6389\u62ff\u6700\u591a\u85aa\u6c34\u4ee5\u53ca\u62ff\u6700\u5c11\u85aa\u6c34\u7684\u5169\u4eba<\/strong>\u3002\u9019\u7a2e\u4f5c\u6cd5\u4f3c\u4e4e\u662f\u73fe\u5728\u7684\u4e00\u80a1\u8da8\u52e2\u3002<\/p>\n\n\n\n<p class=\"\">\u73fe\u5728\u7d66\u4f60 3 \u4f4d\u54e1\u5de5\u7684\u85aa\u6c34\uff0c\u8acb\u4f60<strong>\u627e\u51fa\u8ab0\u4e0d\u6703\u88ab\u88c1\u54e1<\/strong>\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>\u7b2c\u4e00\u884c\u6709\u4e00\u6574\u6578 T (T &lt; 20) \u4ee3\u8868\u4e0b\u5217\u6709\u5e7e\u884c\u6e2c\u8cc7\u3002\u6bcf\u884c\u6e2c\u8cc7\u5305\u62ec\u4e09\u500b\u6574\u6578\u4ee3\u8868\u4e09\u4eba\u7684\u85aa\u6c34\uff0c\u4ed6\u5011\u7684\u85aa\u6c34\u4ecb\u65bc 1000 \u81f3 10000 \u4e4b\u9593\u3002<\/td><td>\u5c0d\u65bc\u6bcf\u884c\u6e2c\u8cc7\uff0c\u8acb\u8f38\u51fa\u4e00\u884c\u683c\u5f0f\u70ba\u300cCase X: Y\u300d\uff0c\u5176\u4e2d X \u4ee3\u8868\u7b2c\u5e7e\u7b46\u6e2c\u8cc7\uff0cY \u4ee3\u8868\u4e0d\u6703\u88ab\u88c1\u54e1\u7684\u54e1\u5de5\u85aa\u6c34\u3002<\/td><\/tr><tr><td>3<br>1000 2000 3000<br>3000 2500 1500<br>1500 1200 1800<\/td><td>Case 1: 2000<br>Case 2: 2500<br>Case 3: 1500<\/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=\"\">\u5c07\u4e09\u500b\u6578\u5b57\u6536\u5230 Vector \u6216\u9663\u5217\u4e2d\uff0c\u7136\u5f8c<strong>\u9032\u884c\u6392\u5e8f<\/strong>\uff0c\u518d\u5c07<strong>\u7b2c\u4e00\u500b\u4f4d\u7f6e\u7684\u8cc7\u6599 (\u4e2d\u9593\u7684\u8cc7\u6599) \u8f38\u51fa\u5373\u53ef<\/strong>\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=d659\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge D659: Cost Cutting<\/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-plain\"><code>#include &lt;iostream&gt;\n#include &lt;vector&gt;\n#include &lt;algorithm&gt;\nusing namespace std;\n\nint main() {\n    cin.sync_with_stdio(0);\n    cin.tie(0);\n    int T;\n    cin &gt;&gt; T;\n    for (int i = 0; i&lt;T; i++)\n    {\n        vector&lt;int&gt;num;\n        for (int j = 0; j&lt;3; j++)\n        {\n            int tmp;\n            cin &gt;&gt; tmp;\n            num.push_back(tmp);\n        }\n        sort(num.begin(), num.end());\n        cout &lt;&lt; &quot;Case &quot; &lt;&lt; i+1 &lt;&lt; &quot;: &quot; &lt;&lt; num[1] &lt;&lt; &quot;\\n&quot;;\n    }\n}\n\n\/\/ZeroJudge D659\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u540c\u984c\uff1aUVa 11727 &#8211; Cost Cutting XYZ\u80a1\u4efd\u6709\u9650\u516c\u53f8\u88ab\u5de8\u5927\u7684\u91d1\u878d\u6d77\u562f\u8972\u64ca\u800c\u5fc5 [&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":[20,19,9],"class_list":["post-451","post","type-post","status-publish","format-standard","hentry","category-uva","tag-20","tag-19","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/451","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=451"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/451\/revisions"}],"predecessor-version":[{"id":452,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/451\/revisions\/452"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/media?parent=451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/categories?post=451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/tags?post=451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}