{"id":98,"date":"2022-12-05T21:03:42","date_gmt":"2022-12-05T13:03:42","guid":{"rendered":"https:\/\/forelink.top\/?p=98"},"modified":"2022-12-05T21:03:43","modified_gmt":"2022-12-05T13:03:43","slug":"%e8%b4%aa%e5%bf%83-week-6%ef%bc%89","status":"publish","type":"post","link":"https:\/\/forelink.top\/index.php\/2022\/12\/05\/%e8%b4%aa%e5%bf%83-week-6%ef%bc%89\/","title":{"rendered":"\u8d2a\u5fc3 (Week 6\uff09"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">T1 \u4e09\u56fd\u6e38\u620f<\/h2>\n\n\n\n<p>\u6bcf\u6b21\u9009\u62e9\u90fd\u4e0d\u53ef\u80fd\u9009\u4e2d\u6700\u5927\u9ed8\u5951\u503c\u7684\u6b66\u5c06\uff0c\u6240\u4ee5\u4ece1\u53f7\u5230\u6700\u540e\u4e00\u53f7\u6b66\u5c06\u627e\u4e0e\u4ed6\u9ed8\u5951\u503c\u7b2c\u4e8c\u5927\u7684\u6b66\u5c06\uff0c\u5e76\u4e00\u76f4\u66f4\u65b0\u7b54\u6848\u3002<\/p>\n\n\n\n<p>\u4ee3\u7801\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream>\r\n#include &lt;algorithm>\r\nusing namespace std;\r\nint g&#91;505]&#91;505];\r\nint main(){\r\n\tint n;\r\n\tcin>>n;\r\n\tfor(int i=1;i&lt;=n;i++){\r\n\t\tfor(int j=i+1;j&lt;=n;j++){\r\n\t\t\tcin>>g&#91;i]&#91;j];\r\n\t\t\tg&#91;j]&#91;i]=g&#91;i]&#91;j];\r\n\t\t}\r\n\t}\r\n\tfor(int i=1;i&lt;=n;i++){\r\n\t\tsort(g&#91;i]+1,g&#91;i]+n+1);\r\n\t}\r\n\tint ans=0;\r\n\tfor(int i=1;i&lt;=n;i++){\r\n\t\tif(g&#91;i]&#91;n-1]>ans)\r\n\t\tans=g&#91;i]&#91;n-1];\r\n\t}\r\n\tcout&lt;&lt;\"1\"&lt;&lt;endl&lt;&lt;ans;\r\n\treturn 0;\r\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-black-color has-alpha-channel-opacity has-black-background-color has-background is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">T2 \u72ec\u6728\u6865<\/h2>\n\n\n\n<p>\u662fsummer camp\u7684\u4e00\u9053\u9898\u76ee\u3002<\/p>\n\n\n\n<p>\u4e24\u4e2a\u58eb\u5175\u76f8\u9047\u8c03\u5934\u53ef\u4ee5\u89c6\u4f5c\u7a7f\u4e86\u8fc7\u53bb\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream>\r\nusing namespace std;\r\nconst int N=5e3+5;\r\nint num&#91;N];\r\nint maxs,mins;\r\nint l,r;\r\nint len,n;\r\nint main(){\r\n\tcin>>len>>n;\r\n\tfor(int i=1;i&lt;=n;i++){\r\n\t\tcin>>num&#91;i];\r\n\t\tl=num&#91;i];\r\n\t\tr=len-num&#91;i]+1;\r\n\t\tif(l&lt;r){\r\n\t\t\tif(l>mins) mins=l;\r\n\t\t\tif(r>maxs) maxs=r;\r\n\t\t}\r\n\t\telse{\r\n\t\t\tif(r>mins) mins=r;\r\n\t\t\tif(l>maxs) maxs=l;\r\n\t\t}\r\n\t}\r\n\tcout&lt;&lt;mins&lt;&lt;' '&lt;&lt;maxs;\r\n\treturn 0;\r\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-black-color has-alpha-channel-opacity has-black-background-color has-background is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">T3 \u6392\u961f\u63a5\u6c34<\/h2>\n\n\n\n<p>\u8d2a\u5fc3\u7684\u5165\u95e8\u9898\uff1f<\/p>\n\n\n\n<p>\u4ee3\u7801\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;bits\/stdc++.h>\r\nusing namespace std;\r\nstruct p{\r\n\tint x;\r\n\tint t;\r\n};\r\nint n;\r\ndouble sum;\r\nbool cmp(p a,p b){\r\n\treturn a.t&lt;b.t;\r\n}\r\np a&#91;1005];\r\nint main(){\r\n\tcin>>n;\r\n\tfor(int i=1;i&lt;=n;i++){\r\n\t\tcin>>a&#91;i].t;\r\n\t\ta&#91;i].x=i;\r\n\t}\r\n\tsort(a+1,a+1+n,cmp);\r\n\tfor(int i=1;i&lt;=n;i++){\r\n\t\tsum+=(a&#91;i].t*(n-i));\r\n\t\tcout&lt;&lt;a&#91;i].x&lt;&lt;' ';\r\n\t}\r\n\tdouble ans = sum \/ n;\r\n\tprintf(\"\\n%.2f\",ans);\r\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-black-color has-alpha-channel-opacity has-black-background-color has-background is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">T4 \u5408\u5e76\u679c\u5b50<\/h2>\n\n\n\n<p>\u8981\u7528\u5230\u4f18\u5148\u961f\u5217 priority_queue\u3002(stl\u662f\u4e2a\u597d\u4e1c\u897f\u3002<\/p>\n\n\n\n<p>\u8981\u5305\u542b\u5934\u6587\u4ef6 queue\u3002<\/p>\n\n\n\n<p>\u5934\u4e3a\u5c0f\u5143\u7d20\u7684\u58f0\u660e\u65b9\u5f0f\u3002<\/p>\n\n\n\n<p>\u8d2a\u5fc3\u7b56\u7565\u662f\u6bcf\u6b21\u5408\u5e76\u6700\u5c0f\u7684\u4e24\u5806\u679c\u5b50\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>priority_queue&lt; long long int , vector&lt; long long int > , greater&lt;long long int > <\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream>\r\n#include &lt;queue>\r\n#include &lt;algorithm>\r\nusing namespace std;\r\npriority_queue&lt; long long int , vector&lt; long long int > , greater&lt;long long int > >num;\r\nlong long int n,t,temp,ans;\r\nint main(){\r\n\tcin>>n;\r\n\tfor(int i=1;i&lt;=n;i++){\r\n\t\tcin>>t;\r\n\t\tnum.push(t);\r\n\t}\r\n\twhile(!num.empty()){\r\n\t\ttemp=num.top();\r\n\t\tnum.pop();\r\n\t\tif(num.empty()){\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\ttemp+=num.top();\r\n\t\tnum.pop();\r\n\t\tans+=temp;\r\n\t\tnum.push(temp);\r\n\t}\r\n\tcout&lt;&lt;ans;\r\n\treturn 0;\r\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-black-color has-alpha-channel-opacity has-black-background-color has-background is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e0d\u8db3\uff1a<\/h2>\n\n\n\n<p>\u4f18\u5148\u961f\u5217\u662f\u4e2a\u5565\u4e1c\u897f\u3002<\/p>\n\n\n\n<p>\u770b\u4e86\u975e\u5e38\u591a\u9898\u89e3\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>T1 \u4e09\u56fd\u6e38\u620f \u6bcf\u6b21\u9009\u62e9\u90fd\u4e0d\u53ef\u80fd\u9009\u4e2d\u6700\u5927\u9ed8\u5951\u503c\u7684\u6b66\u5c06\uff0c\u6240\u4ee5\u4ece1\u53f7\u5230\u6700\u540e\u4e00\u53f7\u6b66\u5c06\u627e\u4e0e\u4ed6\u9ed8\u5951\u503c\u7b2c\u4e8c\u5927\u7684\u6b66\u5c06\uff0c\u5e76\u4e00\u76f4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[3,12],"tags":[],"class_list":["post-98","post","type-post","status-publish","format-standard","hentry","category-3","category-12"],"_links":{"self":[{"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/posts\/98","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/comments?post=98"}],"version-history":[{"count":1,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/posts\/98\/revisions"}],"predecessor-version":[{"id":99,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/posts\/98\/revisions\/99"}],"wp:attachment":[{"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/media?parent=98"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/categories?post=98"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/tags?post=98"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}