{"id":366,"date":"2011-08-06T14:52:41","date_gmt":"2011-08-06T06:52:41","guid":{"rendered":"http:\/\/wangkaixuan.tech\/?p=366"},"modified":"2020-06-06T14:53:23","modified_gmt":"2020-06-06T06:53:23","slug":"%e6%95%b0%e5%ad%97%e4%b8%89%e8%a7%92%e5%bd%a2-%e9%80%92%e5%bd%92","status":"publish","type":"post","link":"http:\/\/www.wangkaixuan.tech\/?p=366","title":{"rendered":"\u6570\u5b57\u4e09\u89d2\u5f62 \u9012\u5f52"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>\/*\n \u9012\u5f52\u8fc7\u7a0b\u770b\u4e86\u534a\u5929\u3002\u3002\u3002\n a little weak\u3002\u3002\u3002\n \u603b\u4f53\u8fc7\u7a0b\u662f\u8fd9\u6837\u7684\uff1a\n \u4ece\u4e0a\u800c\u4e0b\u5bf9\u5176\u4e0b\u5c42\u7684\u6b63\u4e0b\u65b9\u7684\u5143\u7d20\u548c\u5176\u6b63\u4e0b\u65b9\u7684\u53f3\u8fb9\u7684\u90a3\u4e2a\u5143\u7d20\u8fdb\u884c\u6bd4\u8f83\n \u8fd4\u56de\u8f83\u5927\uff08\u5c0f\uff09\u7684\n \u5982\u679c\u5176\u4e0b\u5c42\u5df2\u7ecf\u662f\u6700\u540e\u4e00\u5c42\u5c31\u76f4\u63a5\u8fd4\u56de\uff0c\u5426\u5219\u5c31\u8c03\u7528\u5176\u81ea\u8eab\u5f62\u6210\u9012\u5f52\n \u6570\u5b66\u5dee\uff0c\u771f\u53ef\u6015\uff01 \n *\/\n#define LOCAL\n#include&lt;iostream>\nusing namespace std;\n#define N 100\nint a&#91;N]&#91;N];\nint sum(int i, int j, int n)\n{\n\tint left, right;\n\tif (i == n - 1)\n\t\treturn a&#91;i]&#91;j];\n\tif ((left = sum(i + 1, j, n)) > (right = sum(i + 1, j + 1, n)))\n\t\treturn left + a&#91;i]&#91;j];\n\telse\n\t\treturn right + a&#91;i]&#91;j];\n}\nint main()\n{\n#ifdef LOCAL\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n#endif\n\n\tint i, j, n;\n\twhile (cin >> n)\n\t{\n\t\tfor (i = 0; i &lt; n; i++)\n\t\t{\n\t\t\tfor (j = 0; j &lt;= i; j++)\n\t\t\t\tcin >> a&#91;i]&#91;j];\n\t\t}\n\t\tcout &lt;&lt; sum(0, 0, n) &lt;&lt; endl;\n\t}\n\treturn 0;\n}\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":[12],"tags":[],"class_list":["post-366","post","type-post","status-publish","format-standard","hentry","category-06-03-play-ground"],"_links":{"self":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/366","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=366"}],"version-history":[{"count":0,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/366\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=366"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}