{"id":731,"date":"2019-10-08T23:10:08","date_gmt":"2019-10-08T15:10:08","guid":{"rendered":"http:\/\/fankasy.xyz\/?p=731"},"modified":"2019-10-08T23:13:08","modified_gmt":"2019-10-08T15:13:08","slug":"noj1032-%e4%b8%89%e8%a7%92%e5%bd%a2%e6%95%b0","status":"publish","type":"post","link":"http:\/\/fankasy.xyz\/index.php\/2019\/10\/08\/noj1032-%e4%b8%89%e8%a7%92%e5%bd%a2%e6%95%b0\/","title":{"rendered":"NOJ1032 \u4e09\u89d2\u5f62\u6570"},"content":{"rendered":"\n<p>\u8fd9\u4e2a\u95ee\u9898\u7406\u8bba\u4e0a\u5c31\u662f\u7528\u5b57\u7b26\u4e32\u4ee3\u66ff\u6570\u5b57\u7c7b\u578b\u8fdb\u884c\u5927\u6570\u8fd0\u7b97\uff0c\u5176\u5b9e\u73b0\u8d77\u6765\u6bd4\u8f83\u590d\u6742\u3002\u6211\u66fe\u7ecf\u5b9e\u73b0\u8fc7\u4e00\u6b21\u5927\u6570\u52a0\u6cd5\uff0c\u4f46\u5b9e\u5728\u88ab\u6076\u5fc3\u5230\u4e86\u3002<br> \u4e8e\u662f\u4e4e\u8fd9\u6b21\uff0c\u6211\u5145\u5206\u53d1\u6325\u4e86<strong>\u9762\u5411\u767e\u5ea6\u7f16\u7a0b<\/strong>\u601d\u60f3\uff0c\u719f\u7ec3<strong>Ctrl+C\uff0cCtrl+V<\/strong>\uff0c\u5e76\u5728\u7814\u8bfb\u6587\u7ae0\u540e\u987a\u5229\u5b8c\u6210\u4e86\u8fd9\u4e2a\u9898\u76ee\u3002<br> \u9644\u4e0a\u9020\u8f6e\u5b50\u7684dalao\uff1a<a href=\"https:\/\/blog.csdn.net\/code4101\/article\/details\/23020525\">https:\/\/blog.csdn.net\/code4101\/article\/details\/23020525<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream>\n#include &lt;string>\n#include &lt;cstring>\n#include &lt;cstdio>\n#include&lt;algorithm>\nusing namespace std;\n\nconst int maxn = 1000;\n\nstruct bign {\n    int d[maxn], len;\n\n    void clean() { while (len > 1 &amp;&amp; !d[len - 1]) len--; }\n\n    bign() { memset(d, 0, sizeof(d)); len = 1; }\n    bign(int num) { *this = num; }\n    bign(char* num) { *this = num; }\n    bign operator = (const char* num) {\n        memset(d, 0, sizeof(d)); len = strlen(num);\n        for (int i = 0; i &lt; len; i++) d[i] = num[len - 1 - i] - '0';\n        clean();\n        return *this;\n    }\n    bign operator = (int num) {\n        char s[20]; sprintf(s, \"%d\", num);\n        *this = s;\n        return *this;\n    }\n\n    bign operator + (const bign &amp; b) {\n        bign c = *this; int i;\n        for (i = 0; i &lt; b.len; i++) {\n            c.d[i] += b.d[i];\n            if (c.d[i] > 9) c.d[i] %= 10, c.d[i + 1]++;\n        }\n        while (c.d[i] > 9) c.d[i++] %= 10, c.d[i]++;\n        c.len = max(len, b.len);\n        if (c.d[i] &amp;&amp; c.len &lt;= i) c.len = i + 1;\n        return c;\n    }\n    bign operator - (const bign &amp; b) {\n        bign c = *this; int i;\n        for (i = 0; i &lt; b.len; i++) {\n            c.d[i] -= b.d[i];\n            if (c.d[i] &lt; 0) c.d[i] += 10, c.d[i + 1]--;\n        }\n        while (c.d[i] &lt; 0) c.d[i++] += 10, c.d[i]--;\n        c.clean();\n        return c;\n    }\n    bign operator * (const bign &amp; b)const {\n        int i, j; bign c; c.len = len + b.len;\n        for (j = 0; j &lt; b.len; j++) for (i = 0; i &lt; len; i++)\n            c.d[i + j] += d[i] * b.d[j];\n        for (i = 0; i &lt; c.len - 1; i++)\n            c.d[i + 1] += c.d[i] \/ 10, c.d[i] %= 10;\n        c.clean();\n        return c;\n    }\n    bign operator \/ (const bign &amp; b) {\n        int i, j;\n        bign c = *this, a = 0;\n        for (i = len - 1; i >= 0; i--)\n        {\n            a = a * 10 + d[i];\n            for (j = 0; j &lt; 10; j++) if (a &lt; b * (j + 1)) break;\n            c.d[i] = j;\n            a = a - b * j;\n        }\n        c.clean();\n        return c;\n    }\n    bign operator % (const bign &amp; b) {\n        int i, j;\n        bign a = 0;\n        for (i = len - 1; i >= 0; i--)\n        {\n            a = a * 10 + d[i];\n            for (j = 0; j &lt; 10; j++) if (a &lt; b * (j + 1)) break;\n            a = a - b * j;\n        }\n        return a;\n    }\n    bign operator += (const bign &amp; b) {\n        *this = *this + b;\n        return *this;\n    }\n\n    bool operator &lt;(const bign &amp; b) const {\n        if (len != b.len) return len &lt; b.len;\n        for (int i = len - 1; i >= 0; i--)\n            if (d[i] != b.d[i]) return d[i] &lt; b.d[i];\n        return false;\n    }\n    bool operator >(const bign &amp; b) const { return b &lt; *this; }\n    bool operator&lt;=(const bign &amp; b) const { return !(b &lt; *this); }\n    bool operator>=(const bign &amp; b) const { return !(*this &lt; b); }\n    bool operator!=(const bign &amp; b) const { return b &lt; *this || *this &lt; b; }\n    bool operator==(const bign &amp; b) const { return !(b &lt; *this) &amp;&amp; !(b > * this); }\n\n    string str() const {\n        char s[maxn] = {};\n        for (int i = 0; i &lt; len; i++) s[len - 1 - i] = d[i] + '0';\n        return s;\n    }\n};\n\nistream&amp; operator >> (istream &amp; in, bign &amp; x)\n{\n    string s;\n    in >> s;\n    x = s.c_str();\n    return in;\n}\n\nostream&amp; operator &lt;&lt; (ostream &amp; out, const bign &amp; x)\n{\n    out &lt;&lt; x.str();\n    return out;\n}\nint main()\n{\n    bign A, B;\n    while (cin >> A)\n    {\n        B = A;\n        cout &lt;&lt; (A * (B + 1) \/ 2) &lt;&lt; endl;\n    }\n    return 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u4e2a\u95ee\u9898\u7406\u8bba\u4e0a\u5c31\u662f\u7528\u5b57\u7b26\u4e32\u4ee3\u66ff\u6570\u5b57\u7c7b\u578b\u8fdb\u884c\u5927\u6570\u8fd0\u7b97\uff0c\u5176\u5b9e\u73b0\u8d77\u6765\u6bd4\u8f83\u590d\u6742\u3002\u6211\u66fe\u7ecf\u5b9e\u73b0\u8fc7\u4e00\u6b21\u5927\u6570\u52a0\u6cd5\uff0c\u4f46\u5b9e\u5728\u88ab\u6076\u5fc3 [&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\/731"}],"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=731"}],"version-history":[{"count":0,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/posts\/731\/revisions"}],"wp:attachment":[{"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=731"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/fankasy.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}