{"id":679,"date":"2019-06-09T12:13:54","date_gmt":"2019-06-09T04:13:54","guid":{"rendered":"http:\/\/fankasy.xyz\/?p=679"},"modified":"2019-09-26T12:15:58","modified_gmt":"2019-09-26T04:15:58","slug":"noj1161-%e9%a3%9e%e5%bc%b9","status":"publish","type":"post","link":"http:\/\/fankasy.xyz\/index.php\/2019\/06\/09\/noj1161-%e9%a3%9e%e5%bc%b9\/","title":{"rendered":"NOJ1161 \u98de\u5f39"},"content":{"rendered":"<pre>\r\n#include&lt;stdio.h&gt;\r\n#include&lt;stdlib.h&gt;\r\n\/*\r\n\u98de\u5f39\u80fd\u591f\u6cbf\u56fa\u5b9a\u65b9\u5411\u6467\u6bc1\u9ad8\u5ea6\u9012\u51cf\u7684\u76ee\u6807\u3002\r\n\u73b0\u5728\u5df2\u77e5\u4e00\u76f4\u7ebf\u4e0a\u4ece\u5de6\u5230\u53f3\u5404\u4e2a\u76ee\u6807\u7684\u9ad8\u5ea6\u3002\u9700\u8981\u4f60\u6c42\u51fa\u98de\u5f39\u6700\u591a\u80fd\u591f\u6467\u6bc1\u591a\u5c11\u76ee\u6807\u3002\r\n\u98de\u5f39\u81ea\u6700\u5de6\u7aef\u53d1\u5c04\uff0c\u8d77\u59cb\u9ad8\u5ea6\u4efb\u610f\uff0c\u4ece\u5de6\u81f3\u53f3\u6467\u6bc1\u76ee\u6807\u3002\r\n          \r\n*\/\r\nint main()\r\n{\r\n    int target_height[1002] = { 0 };\r\n    int destory[1002];\r\n    int NUM = 0;\r\n    int max = -10;\r\n    scanf(\"%d\", &amp;NUM);\r\n    for (int i = 0; i &lt; NUM; i++)\/\/\u8f93\u5165\u76ee\u6807\u53c2\u6570 { scanf(\"%d\", &amp;target_height[i]); destory[i] = 1; \/\/scanf(\"% *[^ \\n] % *c\"); } for (int i = NUM-1; i &gt;=0; i--)\/\/\u66b4\u529b\u6d4b\u8bd5\r\n    {\r\n        max = 0;\r\n        for (int k = i+1; k &lt; NUM; k++)\r\n            if (target_height[k] &lt; target_height[i] &amp;&amp; max &lt; destory[k])    \/\/\u8868\u660e\u67d0\u4e00\u76ee\u6807\u540e\u5934\u80fd\u6253\u591a\u5c11\u4e2a\r\n                max = destory[k];\r\n\r\n        destory[i] += max;                 \/\/\u5f53\u524d\u7684\u4e00\u4e2a\u52a0\u4e0a\u80fd\u6253\u7684\u591a\u5c11\u4e2a\u5c31\u662f\u603b\u6570\r\n    }\r\n    for (int i = 0; i &lt; NUM; i++)\r\n    {\r\n        if (max &lt; destory[i])\r\n            max = destory[i];\r\n    }\r\n    printf(\"%d\", max);\r\n    return 0;\r\n\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; \/* \u98de\u5f39\u80fd [&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\/679"}],"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=679"}],"version-history":[{"count":0,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/posts\/679\/revisions"}],"wp:attachment":[{"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=679"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}