{"id":84,"date":"2011-08-04T13:25:19","date_gmt":"2011-08-04T05:25:19","guid":{"rendered":"http:\/\/wangkaixuan.tech\/?p=84"},"modified":"2020-06-03T13:25:56","modified_gmt":"2020-06-03T05:25:56","slug":"zoj-1095-humble-numbers","status":"publish","type":"post","link":"http:\/\/www.wangkaixuan.tech\/?p=84","title":{"rendered":"zoj 1095 Humble Numbers"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>\/*\n\u6b64\u9898\u6709\u4e00\u79cd\u5e38\u89c4\u89e3\u6cd5\n\u5c31\u662f\u8bbe\u4e00\u4e2a\u957f\u5ea6\u4e3a 5842 \u7684\u6570\u7ec4\n\u5f80\u91cc\u9762\u5b58\u6570\n\u7531\u4e8e\u5df2\u77e5\u6570\u7ec4\u4e2d\u5b58\u653e\u7684\u6700\u5927\u6570\u4e3a2000000000\n\u800c\u4e14\u6570\u7ec4\u4e2d\u5143\u7d20\u90fd\u662f\u7531\u5176\u4e2d\u5143\u7d20\u4e0e2 3 5 7\u7684\u79ef\u7ec4\u6210\u7684\n\u6240\u4ee5\u53ea\u9700\u5faa\u73af5842\u6b21\u5c06\u5c0f\u4e8e\u7b49\u4e8e\u4e0a\u754c\u4e14\u4e0d\u4e0e\u5df2\u4ea7\u751f\u7684\u5143\u7d20\u76f8\u7b49\u7684\u5143\u7d20\u586b\u5165\u8868\u4e2d\u5373\u53ef\n\u7136\u540e\u5728\u5bf9\u6570\u7ec4\u4e2d\u5143\u7d20\u8fdb\u884c\u6392\u5e8f\n\u6700\u540e\u8f93\u51fahum&#91;n-1]\u5373\u53ef\n\u4e0b\u9762\u662f\u53e6\u4e00\u79cd\u66f4\u4e3a\u5de7\u5999\u4e14\u6548\u7387\u66f4\u9ad8\u7684\u89e3\u6cd5 \n*\/\n#define LOCAL\n#include&lt;iostream>\nusing namespace std;\n#define N 5842\nint main()\n{\n#ifdef LOCAL\n       freopen(\"input.txt\",\"r\",stdin);\n       freopen(\"output.txt\",\"w\",stdout);\n#endif\n    int t1,t2,m&#91;4]={0,0,0,0},i,n,hum&#91;N]={1};\n    for(i=1;i&lt;N;i++)\n    {\n           t1=(2*hum&#91;m&#91;0]]>3*hum&#91;m&#91;1]]?3*hum&#91;m&#91;1]]:2*hum&#91;m&#91;0]]);              \n           t2=(5*hum&#91;m&#91;2]]>7*hum&#91;m&#91;3]]?7*hum&#91;m&#91;3]]:5*hum&#91;m&#91;2]]);\n           hum&#91;i]=(t1>t2?t2:t1); \n           if(hum&#91;i]==2*hum&#91;m&#91;0]]) m&#91;0]++;      \/\/\u8fd9\u91cc\u4e0d\u80fd\u5199\u6210else if() \n           if(hum&#91;i]==3*hum&#91;m&#91;1]]) m&#91;1]++;      \/\/\u53bb\u91cd\u7684\u5173\u952e\u6b65\u9aa4\uff01 \n           if(hum&#91;i]==5*hum&#91;m&#91;2]]) m&#91;2]++;\n           if(hum&#91;i]==7*hum&#91;m&#91;3]]) m&#91;3]++;\n    } \n    while(cin>>n&amp;&amp;n)\n    {\n            cout&lt;&lt;\"The \"&lt;&lt;n;\n            if(n%100==11||n%100==12||n%100==13||n%100==14) cout&lt;&lt;\"th humble number is \"; \/\/\u6ce8\u610f\u8fd9\u91cc\uff01 \n            else switch(n%10)\n            {\n                case 1:cout&lt;&lt;\"st humble number is \";break;\n                case 2:cout&lt;&lt;\"nd humble number is \";break;\n                case 3:cout&lt;&lt;\"rd humble number is \";break;\n                default:cout&lt;&lt;\"th humble number is \";break;            \n            }                \n            cout&lt;&lt;hum&#91;n-1];\n            cout&lt;&lt;\".\"&lt;&lt;endl;\n    }\n    return 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-84","post","type-post","status-publish","format-standard","hentry","category-06-01-acm"],"_links":{"self":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/84","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=84"}],"version-history":[{"count":0,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/84\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}