{"id":1587,"date":"2026-05-19T16:10:03","date_gmt":"2026-05-19T08:10:03","guid":{"rendered":"http:\/\/wordpress.fangt.online\/?p=1587"},"modified":"2026-05-19T16:10:03","modified_gmt":"2026-05-19T08:10:03","slug":"%e9%ab%98%e7%b2%be%e5%ba%a6%e9%99%a4%e6%b3%95%ef%bc%88%e9%ab%98%e7%b2%be%e9%99%a4%e4%bb%a5%e4%bd%8e%e7%b2%be%ef%bc%89","status":"publish","type":"post","link":"http:\/\/wordpress.fangt.online\/index.php\/2026\/05\/19\/%e9%ab%98%e7%b2%be%e5%ba%a6%e9%99%a4%e6%b3%95%ef%bc%88%e9%ab%98%e7%b2%be%e9%99%a4%e4%bb%a5%e4%bd%8e%e7%b2%be%ef%bc%89\/","title":{"rendered":"\u9ad8\u7cbe\u5ea6\u9664\u6cd5\uff08\u9ad8\u7cbe\u9664\u4ee5\u4f4e\u7cbe\uff09"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">\u57fa\u672c\u539f\u7406<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u9ad8\u7cbe\u5ea6\u9664\u4ee5\u4f4e\u7cbe\u5ea6\uff0c\u6a21\u62df\u624b\u5de5\u7ad6\u5f0f\u9664\u6cd5\u3002\u4f8b\u5982\u8ba1\u7b97&nbsp;<code>12345 \u00f7 6<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>      2 0 5 7  (\u5546)\n  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\n6 \u2502 1 2 3 4 5\n     1 2\n     ---\n       0 3\n         0\n        ---\n         3 4\n         3 0\n         ---\n           4 5\n           4 2\n           ---\n             3  (\u4f59\u6570)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5173\u952e\u6b65\u9aa4\uff1a<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>\u4ece\u88ab\u9664\u6570\u7684\u6700\u9ad8\u4f4d\u5f00\u59cb\uff0c\u4f9d\u6b21\u53d6\u4e00\u4f4d\u6216\u591a\u4f4d\uff0c\u76f4\u5230\u4e0d\u5c0f\u4e8e\u9664\u6570\u3002<\/li>\n\n\n\n<li>\u5f53\u524d\u88ab\u9664\u6570\u90e8\u5206\u9664\u4ee5\u9664\u6570\uff0c\u5f97\u5230\u5546\u7684\u5f53\u524d\u4f4d\uff0c\u4f59\u6570\u4f5c\u4e3a\u4e0b\u4e00\u6b21\u7684\u88ab\u9664\u6570\u90e8\u5206\u3002<\/li>\n\n\n\n<li>\u91cd\u590d\u76f4\u5230\u6240\u6709\u4f4d\u5904\u7406\u5b8c\u3002<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u8ba1\u7b97\u673a\u5b9e\u73b0\u4e2d\uff0c\u6211\u4eec\u901a\u5e38\u4f7f\u7528\u4e00\u4e2a\u53d8\u91cf&nbsp;<code>remainder<\/code>&nbsp;\u6765\u8bb0\u5f55\u5f53\u524d\u7684\u4f59\u6570\uff08\u6216\u79f0\u4e3a\u201c\u88ab\u9664\u6570\u90e8\u5206\u201d\uff09\u3002\u56e0\u4e3a\u9664\u6570\u8f83\u5c0f\uff0c\u6211\u4eec\u53ef\u4ee5\u7528\u5faa\u73af\u6a21\u62df\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4ee3\u7801\u5b9e\u73b0<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream>\n#include &lt;string>\n#include &lt;algorithm>\nusing namespace std;\n\n\/\/ \u9ad8\u7cbe\u5ea6\u9664\u6cd5\uff1a\u5927\u6570\u5b57\u7b26\u4e32 s \u9664\u4ee5\u6574\u6570 b\uff0c\u8fd4\u56de\u5546\uff08\u5b57\u7b26\u4e32\uff09\uff0c\u4f59\u6570\u901a\u8fc7\u5f15\u7528\u8fd4\u56de\nstring divString(const string&amp; s, int b, int&amp; remainder) {\n    string quot;\n    remainder = 0;\n    for (char ch : s) {               \/\/ \u4ece\u5de6\u5230\u53f3\uff08\u9ad8\u4f4d\u5230\u4f4e\u4f4d\uff09\n        int cur = remainder * 10 + (ch - '0');\n        quot.push_back(cur \/ b + '0');\n        remainder = cur % b;\n    }\n    \/\/ \u53bb\u6389\u524d\u5bfc\u96f6\uff0c\u4f46\u4fdd\u7559\u4e00\u4e2a '0'\n    size_t pos = quot.find_first_not_of('0');\n    if (pos == string::npos) return \"0\";\n    return quot.substr(pos);\n}\n\nint main() {\n    string s;\n    int b;\n    cin >> s >> b;\n    int rem;\n    string q = divString(s, b, rem);\n    cout &lt;&lt; \"\u5546: \" &lt;&lt; q &lt;&lt; \"\\n\u4f59\u6570: \" &lt;&lt; rem &lt;&lt; endl;\n    return 0;\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u9664\u6cd5<\/strong>\uff1a<code>string<\/code>\u00a0\u6b63\u5e8f\u5b58\u50a8\uff08\u9ad8\u4f4d\u5728\u5de6\uff09\u6700\u81ea\u7136\uff0c\u4ee3\u7801\u51e0\u4e4e\u548c\u624b\u52a8\u8ba1\u7b97\u4e00\u6837\u3002<\/li>\n\n\n\n<li><strong>\u52a0\u51cf\u4e58\u6cd5<\/strong>\uff1a\u5c0f\u7aef\u5e8f\u6570\u7ec4\u66f4\u65b9\u4fbf\u8fdb\u4f4d\/\u501f\u4f4d\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u57fa\u672c\u539f\u7406 \u9ad8\u7cbe\u5ea6\u9664\u4ee5\u4f4e\u7cbe\u5ea6\uff0c\u6a21\u62df\u624b\u5de5\u7ad6\u5f0f\u9664\u6cd5\u3002\u4f8b\u5982\u8ba1\u7b97&nbsp;12345 \u00f7 6\uff1a \u5173\u952e\u6b65\u9aa4\uff1a \u5728\u8ba1\u7b97\u673a\u5b9e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[],"class_list":["post-1587","post","type-post","status-publish","format-standard","hentry","category-zl"],"_links":{"self":[{"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts\/1587","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/comments?post=1587"}],"version-history":[{"count":1,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts\/1587\/revisions"}],"predecessor-version":[{"id":1588,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts\/1587\/revisions\/1588"}],"wp:attachment":[{"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/media?parent=1587"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/categories?post=1587"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/tags?post=1587"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}