{"id":485,"date":"2020-02-27T18:11:47","date_gmt":"2020-02-27T10:11:47","guid":{"rendered":"http:\/\/www.guanhaobo.cn\/?p=485"},"modified":"2020-02-27T18:11:47","modified_gmt":"2020-02-27T10:11:47","slug":"%e5%90%ab%e5%b9%b6%e5%88%97%e5%90%8d%e6%ac%a1%e7%9a%84%e6%8e%92%e5%90%8d","status":"publish","type":"post","link":"https:\/\/www.guanhaobo.cn\/?p=485","title":{"rendered":"\u542b\u5e76\u5217\u540d\u6b21\u7684\u6392\u540d"},"content":{"rendered":"<h3>\u5f15\u8a00<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u8bed\u6587<\/th>\n<th>\u6570\u5b66<\/th>\n<th>\u82f1\u8bed<\/th>\n<th>\u603b\u5206<\/th>\n<th>\u540d\u6b21<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>88<\/td>\n<td>90<\/td>\n<td>87<\/td>\n<td>265<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>88<\/td>\n<td>87<\/td>\n<td>90<\/td>\n<td>265<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>90<\/td>\n<td>85<\/td>\n<td>88<\/td>\n<td>263<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>68<\/td>\n<td>95<\/td>\n<td>60<\/td>\n<td>223<\/td>\n<td>4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u50cf\u4e0a\u9762\u8fd9\u6837\u7684\u6392\u540d\u662f\u751f\u6d3b\u4e2d\u5f88\u5e38\u89c1\u7684\uff0c\u5373\u5206\u6570\u76f8\u540c\u7684\u5b66\u751f\u4f1a\u6709\u76f8\u540c\u7684\u6392\u540d\u3002\u4e24\u4e2a265\u5206\u90fd\u662f\u7b2c\u4e00\u540d\uff0c\u540e\u9762\u6ca1\u6709\u7b2c\u4e8c\u540d\uff0c\u76f4\u63a5\u5c31\u662f\u7b2c\u4e09\u540d\u3002<br \/>\n\u5728excel\u4e2d\u53ef\u4ee5\u4f7f\u7528rank\u51fd\u6570\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\uff0c\u5728\u7f16\u7a0b\u4e2d\u5e94\u8be5\u600e\u4e48\u5b9e\u73b0\u5462\uff1f<br \/>\n\u4e0b\u9762\u4f7f\u7528C++\u6765\u4e3e\u4f8b\u8bf4\u660e\u3002<\/p>\n<h3>C++\u5b9e\u73b0<\/h3>\n<p>\u57fa\u672c\u601d\u60f3\uff1a<br \/>\n1. \u4f7f\u7528sort\u51fd\u6570\u4ee5\u603b\u5206\u4e3a\u6807\u51c6\u8fdb\u884c\u6392\u5e8f<br \/>\n2. \u4ece\u4e0b\u6807\u4e3a1\u7684\u5b66\u751f\u5f00\u59cb\uff0c\u5224\u65ad\u603b\u5206\u662f\u5426\u4e0e\u524d\u4e00\u540d\u76f8\u540c\u3002\u5982\u679c\u76f8\u540c\uff0c\u5219\u6392\u540d\u7b49\u4e8e\u524d\u4e00\u540d\u7684\u6392\u540d\uff1b\u5982\u679c\u4e0d\u76f8\u540c\uff0c\u5219\u6392\u540d\u7b49\u4e8e\uff08\u5f53\u524d\u4e0b\u6807+1\uff09\u3002<\/p>\n<h5>\u6837\u4f8b\u8f93\u5165<\/h5>\n<pre><code class=\"language-txt line-numbers\">4\n\u5f20\u4e09 90 85 88\n\u5173\u54e5 88 90 87\n\u738b\u4e8c 68 95 60\n\u674e\u56db 88 87 90\n<\/code><\/pre>\n<h5>\u6837\u4f8b\u8f93\u51fa<\/h5>\n<pre><code class=\"language-txt line-numbers\">\u59d3\u540d \u8bed\u6587 \u6570\u5b66 \u82f1\u8bed \u603b\u5206 \u6392\u540d\n\u5173\u54e5  88  90   87  265   1\n\u674e\u56db  88  87   90  265   1\n\u5f20\u4e09  90  85   88  263   3\n\u738b\u4e8c  68  95   60  223   4\n<\/code><\/pre>\n<h5>\u4ee3\u7801<\/h5>\n<pre><code class=\"language-cpp line-numbers\">#include &lt;bits\/stdc++.h&gt;\nusing namespace std;\nstruct node\n{\n    string name;\n    int yuwen, shuxue, yingyu, sum, Rank;\n    bool operator&lt;(const node &amp;s2)\n    {\n        return sum &gt; s2.sum;\n    }\n} stu[1000];\n\nint main()\n{\n    int n, i;\n    cin &gt;&gt; n;\n    for (i = 0; i &lt; n; i++)\n    {\n        cin &gt;&gt; stu[i].name &gt;&gt; stu[i].yuwen &gt;&gt; stu[i].shuxue &gt;&gt; stu[i].yingyu;\n        stu[i].sum = stu[i].yuwen + stu[i].shuxue + stu[i].yingyu;\n    }\n    sort(stu, stu + n);\n    for (i = 0; i &lt; n; i++)\n    {\n        if (i &amp;&amp; stu[i].sum == stu[i - 1].sum)\n            stu[i].Rank = stu[i - 1].Rank;\n        else\n            stu[i].Rank = i + 1;\n    }\n    cout &lt;&lt; endl\n         &lt;&lt; \"\u59d3\u540d \u8bed\u6587 \u6570\u5b66 \u82f1\u8bed \u603b\u5206 \u6392\u540d\" &lt;&lt; endl;\n    for (i = 0; i &lt; n; i++)\n        cout &lt;&lt; stu[i].name &lt;&lt; \"  \" &lt;&lt; stu[i].yuwen &lt;&lt; \"   \" &lt;&lt; stu[i].shuxue &lt;&lt; \"   \" &lt;&lt; stu[i].yingyu &lt;&lt; \"  \" &lt;&lt; stu[i].sum &lt;&lt; \"   \" &lt;&lt; stu[i].Rank &lt;&lt; endl;\n    return 0;\n}\n<\/code><\/pre>\n<h5>\u8fd0\u884c\u622a\u56fe<\/h5>\n<p><img decoding=\"async\" src=\"http:\/\/www.guanhaobo.cn\/wp-content\/uploads\/2020\/02\/1001.jpg\" alt=\"\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f15\u8a00 \u8bed\u6587 \u6570\u5b66 \u82f1\u8bed \u603b\u5206 \u540d\u6b21 88 90 87 265 1 88 87 90 265 1 90 85 8 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[65],"class_list":["post-485","post","type-post","status-publish","format-standard","hentry","category-note","tag-65"],"_links":{"self":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts\/485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=485"}],"version-history":[{"count":0,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts\/485\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}