{"id":700,"date":"2019-09-28T17:17:57","date_gmt":"2019-09-28T09:17:57","guid":{"rendered":"http:\/\/fankasy.xyz\/?p=700"},"modified":"2019-09-28T17:17:57","modified_gmt":"2019-09-28T09:17:57","slug":"noj1023-%e5%ad%97%e7%ac%a6%e4%b8%b2%e6%8e%92%e5%ba%8f","status":"publish","type":"post","link":"http:\/\/fankasy.xyz\/index.php\/2019\/09\/28\/noj1023-%e5%ad%97%e7%ac%a6%e4%b8%b2%e6%8e%92%e5%ba%8f\/","title":{"rendered":"NOJ1023 \u5b57\u7b26\u4e32\u6392\u5e8f"},"content":{"rendered":"\n<p>\u548c\u4ee5\u5f80\u4e0d\u540c\uff0c\u8fd9\u6b21\u5c24\u4e3a\u4e25\u91cd\uff0c\u5728\u7406\u89e3\u9898\u610f\u65b9\u9762\u3002\u5173\u4e8e\u6b64\u65b9\u9762\u6211\u89c9\u5f97\u6211\u771f\u7684\u5341\u5206\u5bf9\u4e0d\u8d77\u6211\u6240\u6709\u7684\u8bed\u6587\u8001\u5e08(\u8bef&#8230;<\/p>\n\n\n\n<p style=\"font-size:0\">\u5bf9\u6240\u6709\u8f93\u5165\u7684\u6570\u636e\uff0c\u5148\u6309\u5b57\u7b26A\u7684\u4e2a\u6570\u8fdb\u884c\u5347\u5e8f\u6392\u5e8f\uff0c\u5982\u679c\u5b57\u7b26A\u7684\u6570\u91cf\u76f8\u7b49\uff0c<strong>\u518d\u6309\u51fa\u73b0\u7684\u5148\u540e\u987a\u5e8f\u6392\u5e8f<\/strong>\uff0c\u6bcf\u884c\u8f93\u51fa\u4e00\u4e2a\u5b57\u7b26\u4e32 &#8212;&#8212;\u662f\u6309\u5b57\u7b26\u4e32\u51fa\u73b0\u7684\u987a\u5e8f\u6392\u5e8f<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> include&lt;iostream><br> include&lt;vector><br> include&lt;string><br> include&lt;algortihm><br><br> using namespace std;<br> struct CC {<br>     string str;<br>     int firstposition=0;<br>     int amount=0;<br>     void countA();<br>     void positionA();<br>     bool operator&lt;(const CC&amp; A) const     <br>     {    <br>        if (amount &lt; A.amount)            <br>           return true;                <br>        else             <br>            return false;         <br>      } <br>};<br> void CC::countA() <br>{     int amount = 0;     for (auto t : this->str)<br>         if (t == 'A')<br>             amount++;<br>     this->amount = amount;<br> }<br> void CC::positionA()<br> {<br>     int i = 0;<br>     for (; i != (this->str).size(); i++)<br>         if (str[i] == 'A')<br>             this->firstposition = i;<br> }<br> void print_each(const CC&amp; c)<br> {<br>     cout &lt;&lt; c.str &lt;&lt; endl; <br>}<br> <br>int main() <br>{     vector list;<br>     CC temp;<br>     while (cin >> temp.str)<br>     {<br>         temp.countA();<br>         temp.positionA();<br>         list.push_back(temp);<br>     }<br>     sort(list.begin(), list.end());<br>     for_each(list.begin(), list.end(), print_each);<br>     return 0;<br> }<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u548c\u4ee5\u5f80\u4e0d\u540c\uff0c\u8fd9\u6b21\u5c24\u4e3a\u4e25\u91cd\uff0c\u5728\u7406\u89e3\u9898\u610f\u65b9\u9762\u3002\u5173\u4e8e\u6b64\u65b9\u9762\u6211\u89c9\u5f97\u6211\u771f\u7684\u5341\u5206\u5bf9\u4e0d\u8d77\u6211\u6240\u6709\u7684\u8bed\u6587\u8001\u5e08(\u8bef&#8230;  [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17],"tags":[],"_links":{"self":[{"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/posts\/700"}],"collection":[{"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=700"}],"version-history":[{"count":0,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/posts\/700\/revisions"}],"wp:attachment":[{"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=700"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}