{"id":1345,"date":"2026-05-11T14:55:27","date_gmt":"2026-05-11T06:55:27","guid":{"rendered":"http:\/\/wordpress.fangt.online\/?p=1345"},"modified":"2026-05-11T14:56:03","modified_gmt":"2026-05-11T06:56:03","slug":"%e6%9c%80%e5%a4%a7%e5%85%ac%e7%ba%a6%e6%95%b0","status":"publish","type":"post","link":"http:\/\/wordpress.fangt.online\/index.php\/2026\/05\/11\/%e6%9c%80%e5%a4%a7%e5%85%ac%e7%ba%a6%e6%95%b0\/","title":{"rendered":"\u6700\u5927\u516c\u7ea6\u6570"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u5b9a\u4e49<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u6700\u5927\u516c\u7ea6\u6570<\/strong>\uff08Greatest Common Divisor, GCD\uff09\u662f\u6307\u4e24\u4e2a\u6216\u591a\u4e2a\u6574\u6570\u5171\u6709\u7ea6\u6570\u4e2d\u6700\u5927\u7684\u4e00\u4e2a\u3002 \u4f8b\u5982\uff0c12 \u548c 18 \u7684\u516c\u7ea6\u6570\u6709 1\u30012\u30013\u30016\uff0c\u5176\u4e2d\u6700\u5927\u7684 6 \u5c31\u662f\u5b83\u4eec\u7684\u6700\u5927\u516c\u7ea6\u6570\u3002 \u6700\u5927\u516c\u7ea6\u6570\u5728\u6570\u5b66\u3001\u5bc6\u7801\u5b66\u3001\u5206\u6570\u5316\u7b80\u7b49\u9886\u57df\u6709\u5e7f\u6cdb\u5e94\u7528\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u65b9\u6848<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u679a\u4e3e\u6cd5\uff08\u7a77\u4e3e\u6cd5\uff09<\/strong>\uff1a\u4ece\u8f83\u5c0f\u7684\u6570\u5f00\u59cb\u5411\u4e0b\uff08\u6216\u5411\u4e0a\uff09\u9010\u4e00\u68c0\u9a8c\uff0c\u627e\u5230\u6700\u5927\u7684\u80fd\u540c\u65f6\u6574\u9664\u4e24\u4e2a\u6570\u7684\u6570\u3002<\/li>\n\n\n\n<li><strong>\u8f97\u8f6c\u76f8\u9664\u6cd5\uff08\u6b27\u51e0\u91cc\u5f97\u7b97\u6cd5\uff09<\/strong>\uff1a\u53cd\u590d\u7528\u8f83\u5927\u6570\u9664\u4ee5\u8f83\u5c0f\u6570\u53d6\u4f59\uff0c\u76f4\u5230\u4f59\u6570\u4e3a\u96f6\uff0c\u6b64\u65f6\u9664\u6570\u5373\u4e3a\u6700\u5927\u516c\u7ea6\u6570\u3002<\/li>\n\n\n\n<li><strong>\u66f4\u76f8\u51cf\u635f\u6cd5<\/strong>\uff1a\u53e4\u4ee3\u300a\u4e5d\u7ae0\u7b97\u672f\u300b\u4e2d\u7684\u65b9\u6cd5\uff0c\u901a\u8fc7\u53cd\u590d\u76f8\u51cf\uff08\u6216\u7ed3\u5408\u63d0\u53d6\u516c\u56e0\u5b50 2\uff09\u5f97\u5230\u6700\u5927\u516c\u7ea6\u6570\u3002<\/li>\n\n\n\n<li><strong>Stein \u7b97\u6cd5<\/strong>\uff1a\u4e00\u79cd\u4f18\u5316\u7684\u5927\u6574\u6570\u6c42 GCD \u7b97\u6cd5\uff0c\u4e3b\u8981\u9488\u5bf9\u4e8c\u8fdb\u5236\u8fd0\u7b97\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u5177\u4f53\u4ee3\u7801<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u679a\u4e3e\u6cd5\uff08\u7a77\u4e3e\u6cd5\uff09<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u8f93\u5165\u4e24\u4e2a\u6b63\u6574\u6570 (a, b)\uff0c\u8bbe\u8f83\u5c0f\u6570\u4e3a (minVal)\u3002\u4ece (minVal) \u5f00\u59cb\u5411\u4e0b\u9012\u51cf\u5230 1\uff0c\u68c0\u67e5\u6bcf\u4e2a\u6570\u662f\u5426\u80fd\u540c\u65f6\u6574\u9664 (a) \u548c (b)\u3002\u7b2c\u4e00\u4e2a\u6ee1\u8db3\u6761\u4ef6\u7684\u6570\u5373\u4e3a\u6700\u5927\u516c\u7ea6\u6570\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream>\nusing namespace std;\n\nint main() {\n    int a, b;\n    cin >> a >> b;\n\n    \/\/ \u53d6\u8f83\u5c0f\u6570\n    int minVal = (a &lt; b) ? a : b;\n    int gcd = 1;\n\n    \/\/ \u4ece minVal \u5411\u4e0b\u679a\u4e3e\n    for (int i = minVal; i >= 1; i--) {\n        if (a % i == 0 &amp;&amp; b % i == 0) {\n            gcd = i;\n            break;  \/\/ \u627e\u5230\u5373\u9000\u51fa\u5faa\u73af\n        }\n    }\n\n    cout &lt;&lt; gcd &lt;&lt; endl;\n    return 0;\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u8f97\u8f6c\u76f8\u9664\u6cd5\uff08\u6b27\u51e0\u91cc\u5f97\u7b97\u6cd5\uff09<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u8f83\u5927\u6570\u9664\u4ee5\u8f83\u5c0f\u6570\u5f97\u5230\u4f59\u6570\uff0c\u7136\u540e\u7528\u9664\u6570\u4ee3\u66ff\u88ab\u9664\u6570\uff0c\u4f59\u6570\u4ee3\u66ff\u9664\u6570\uff0c\u91cd\u590d\u6b64\u8fc7\u7a0b\u76f4\u5230\u4f59\u6570\u4e3a 0\uff0c\u6b64\u65f6\u7684\u9664\u6570\u5c31\u662f\u6700\u5927\u516c\u7ea6\u6570\u3002 \uff08\u7b97\u6cd5\u4e2d\u4e0d\u9700\u8981\u5224\u65ad\u5927\u5c0f\uff0c\u56e0\u4e3a\u53d6\u4f59\u8fd0\u7b97\u4f1a\u81ea\u52a8\u5904\u7406\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream>\nusing namespace std;\n\nint main() {\n    int a, b;\n    cin >> a >> b;\n\n    int x = a, y = b;  \/\/ \u4fdd\u5b58\u539f\u59cb\u503c\uff0c\u4ee5\u4fbf\u8f93\u51fa\u65f6\u4f7f\u7528\n    \/\/ \u8f97\u8f6c\u76f8\u9664\n    while (y != 0) {\n        int r = x % y;\n        x = y;\n        y = r;\n    }\n    \/\/ \u6b64\u65f6 x \u5373\u4e3a\u6700\u5927\u516c\u7ea6\u6570\n\n    cout &lt;&lt; x &lt;&lt; endl;\n    return 0;\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u66f4\u76f8\u51cf\u635f\u6cd5\uff08\u300a\u4e5d\u7ae0\u7b97\u672f\u300b\uff09<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<ol class=\"wp-block-list\">\n<li>\u8f93\u5165\u4e24\u4e2a\u6b63\u6574\u6570 a \u548c b\u3002<\/li>\n\n\n\n<li>\u82e5 a=b\uff0c\u5219\u6700\u5927\u516c\u7ea6\u6570\u4e3a a\uff08\u6216 b\uff09\uff0c\u7b97\u6cd5\u7ed3\u675f\u3002<\/li>\n\n\n\n<li>\u82e5 a\u2260b\uff0c\u5219\u7528\u8f83\u5927\u6570\u51cf\u53bb\u8f83\u5c0f\u6570\uff0c\u7528\u5dee\u66ff\u6362\u8f83\u5927\u6570\u3002<\/li>\n\n\n\n<li>\u91cd\u590d\u6b65\u9aa4 2 \u548c 3\uff0c\u76f4\u5230\u4e24\u6570\u76f8\u7b49\u4e3a\u6b62\uff0c\u6b64\u65f6\u76f8\u7b49\u7684\u6570\u5373\u4e3a\u6700\u5927\u516c\u7ea6\u6570\u3002<\/li>\n<\/ol>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream>\nusing namespace std;\n\nint main() {\n    int a, b;\n    cin >> a >> b;\n\n    int x = a, y = b;\n    \/\/ \u5f53\u4e24\u6570\u4e0d\u76f8\u7b49\u65f6\uff0c\u4e0d\u65ad\u7528\u5927\u6570\u51cf\u5c0f\u6570\n    while (x != y) {\n        if (x > y)\n            x = x - y;\n        else\n            y = y - x;\n    }\n    \/\/ \u6b64\u65f6 x == y\uff0c\u5373\u4e3a\u6700\u5927\u516c\u7ea6\u6570\n\n    cout &lt;&lt; x &lt;&lt; endl;\n    return 0;\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u603b\u7ed3<\/h2>\n\n\n\n<figure class=\"wp-block-table has-small-font-size\"><table><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">\u65b9\u6cd5<\/th><th class=\"has-text-align-left\" data-align=\"left\">\u4f18\u70b9<\/th><th class=\"has-text-align-left\" data-align=\"left\">\u7f3a\u70b9<\/th><\/tr><\/thead><tbody><tr><td>\u679a\u4e3e\u6cd5<\/td><td>\u7b80\u5355\u76f4\u89c2<\/td><td>\u6548\u7387\u4f4e\uff0c\u9002\u5408\u5c0f\u6574\u6570<\/td><\/tr><tr><td>\u8f97\u8f6c\u76f8\u9664\u6cd5<\/td><td>\u6548\u7387\u9ad8\uff0c\u7a33\u5b9a<\/td><td>\u9700\u8981\u53d6\u6a21\u8fd0\u7b97<\/td><\/tr><tr><td>\u66f4\u76f8\u51cf\u635f\u6cd5<\/td><td>\u53e4\u4ee3\u7b97\u6cd5\uff0c\u9002\u5408\u624b\u5de5\u8ba1\u7b97<\/td><td>\u57fa\u7840\u7248\u6548\u7387\u8f83\u4f4e\uff0c\u4f18\u5316\u540e\u8f83\u597d<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0a\u4e09\u79cd\u65b9\u6cd5\u5747\u80fd\u6b63\u786e\u8ba1\u7b97\u6700\u5927\u516c\u7ea6\u6570\uff0c\u5b9e\u9645\u7f16\u7a0b\u4e2d\u63a8\u8350\u4f7f\u7528<strong>\u8f97\u8f6c\u76f8\u9664\u6cd5<\/strong>\uff0c\u5176\u4ee3\u7801\u7b80\u6d01\u4e14\u6548\u7387\u6700\u9ad8\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b9a\u4e49 \u6700\u5927\u516c\u7ea6\u6570\uff08Greatest Common Divisor, GCD\uff09\u662f\u6307\u4e24\u4e2a\u6216\u591a\u4e2a\u6574\u6570\u5171\u6709\u7ea6\u6570\u4e2d\u6700\u5927\u7684 [&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-1345","post","type-post","status-publish","format-standard","hentry","category-zl"],"_links":{"self":[{"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts\/1345","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=1345"}],"version-history":[{"count":1,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts\/1345\/revisions"}],"predecessor-version":[{"id":1346,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts\/1345\/revisions\/1346"}],"wp:attachment":[{"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/media?parent=1345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/categories?post=1345"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/tags?post=1345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}