{"id":205,"date":"2025-03-15T12:45:51","date_gmt":"2025-03-15T12:45:51","guid":{"rendered":"http:\/\/west.wangyuansheng.cn\/?p=205"},"modified":"2025-07-18T06:04:21","modified_gmt":"2025-07-18T06:04:21","slug":"%e4%b9%b0%e7%b3%95%e7%82%b9","status":"publish","type":"post","link":"http:\/\/west.wangyuansheng.cn\/?p=205","title":{"rendered":"\u4e70\u7cd5\u70b9"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">\u5206\u6790\u95ee\u9898<\/h1>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u5c0f\u660e\u9700\u8981\u82b1\u5149n\u5143\u8d2d\u4e70\u81f3\u5c11\u4e00\u4ef6\u9762\u5305\u548c\u86cb\u631e\uff0c\u5176\u4e2d\u9762\u5305\u6bcf\u4ef6x\u5143\uff0c\u86cb\u631e\u6bcf\u4ef6y\u5143\u3002\u76ee\u6807\u662f\u627e\u5230\u8d2d\u4e70\u65b9\u6848\u4e2d\u9762\u5305\u6570\u91cf\u6700\u591a\u7684\u65b9\u6848\uff0c\u5e76\u8f93\u51fa\u5bf9\u5e94\u7684\u9762\u5305\u548c\u86cb\u631e\u6570\u91cf\u3002<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">\u5efa\u7acb\u6a21\u578b<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u53d8\u91cf\u5b9a\u4e49<\/strong>\uff1a\u8bbe\u8d2d\u4e70\u7684\u9762\u5305\u6570\u91cf\u4e3aa\uff0c\u86cb\u631e\u6570\u91cf\u4e3ab\u3002\u6839\u636e\u9898\u610f\uff0c\u6ee1\u8db3\uff1a<br>a* x + b *y = n (a>1,b>1)<\/li>\n\n\n\n<li><strong>\u76ee\u6807<\/strong>\uff1a\u6700\u5927\u5316a\u7684\u503c\u3002<\/li>\n\n\n\n<li><strong>\u6c42\u89e3\u601d\u8def<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4ece\u53ef\u80fd\u7684\u6700\u5927a\u503c\u5f00\u59cb\u904d\u5386\uff0c\u5373\u5f53b=1\u65f6\uff0c\u6b64\u65f6a\u7684\u6700\u5927\u503c\u4e3a a = (n-by) \/ x<\/li>\n\n\n\n<li>\u5bf9\u6bcf\u4e2aa\uff0c\u68c0\u67e5\u5269\u4f59\u91d1\u989d\u662f\u5426\u80fd\u88aby\u6574\u9664\uff0c\u5e76\u786e\u4fddb\u22651\u3002\u82e5\u6ee1\u8db3\u6761\u4ef6\uff0c\u5219\u4e3a\u6700\u4f18\u89e3\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>\u8f93\u5165n, x, y\n\u8ba1\u7b97a_max = (n - y) \/ x\n\u4ecea_max\u9012\u51cf\u52301\u904d\u5386\u6bcf\u4e2aa\uff1a\n    \u8ba1\u7b97\u5269\u4f59\u91d1\u989dremain = n - a * x\n    \u82e5rem &gt;= y\u4e14remain \u662fy\u7684\u500d\u6570\uff1a\n        \u8f93\u51faa\u548crem \/ y\n        \u7ed3\u675f\u7a0b\u5e8f<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u7f16\u5199\u7a0b\u5e8f<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream&gt;\nusing namespace std;\n\nint main() {\n    int n, x, y;\n    cin &gt;&gt; n &gt;&gt; x &gt;&gt; y;\n\n    int a_max = (n - y) \/ x;\n\n    for (int a = a_max; a &gt;= 1; --a) {\n        int remain = n - a * x;\n        if (remain &gt;= y &amp;&amp; remain % y == 0) {\n            int b = remain \/ y;\n            cout &lt;&lt; a &lt;&lt; \" \" &lt;&lt; b &lt;&lt; endl;\n            return 0;\n        }\n    }\n\n    return 0;\n}<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>\u4ee3\u7801\u89e3\u91ca<\/strong>\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8bfb\u53d6\u8f93\u5165\u7684\u603b\u91d1\u989dn\u3001\u9762\u5305\u5355\u4ef7x\u548c\u86cb\u631e\u5355\u4ef7y\u3002<\/li>\n\n\n\n<li>\u8ba1\u7b97\u53ef\u80fd\u7684\u6700\u5927\u9762\u5305\u6570\u91cfa_max\u3002<\/li>\n\n\n\n<li>\u4ecea_max\u5f00\u59cb\u9012\u51cf\u904d\u5386\uff0c\u68c0\u67e5\u6bcf\u4e2aa\u5bf9\u5e94\u7684\u5269\u4f59\u91d1\u989d\u662f\u5426\u80fd\u88aby\u6574\u9664\uff0c\u5e76\u786e\u4fddb\u22651\u3002<\/li>\n\n\n\n<li>\u627e\u5230\u7b2c\u4e00\u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u89e3\u5373\u4e3a\u6700\u4f18\u89e3\uff0c\u8f93\u51fa\u540e\u7ed3\u675f\u7a0b\u5e8f\u3002<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">\u4fdd\u5b58 \u7f16\u8bd1 \u8fd0\u884c<\/h2>\n","protected":false},"excerpt":{"rendered":"<p>\u5206\u6790\u95ee\u9898 \u5c0f\u660e\u9700\u8981\u82b1\u5149n\u5143\u8d2d\u4e70\u81f3\u5c11\u4e00\u4ef6\u9762\u5305\u548c\u86cb\u631e\uff0c\u5176\u4e2d\u9762\u5305\u6bcf\u4ef6x\u5143\uff0c\u86cb\u631e\u6bcf\u4ef6y\u5143\u3002\u76ee\u6807\u662f\u627e\u5230\u8d2d\u4e70\u65b9\u6848\u4e2d\u9762\u5305\u6570\u91cf\u6700\u591a\u7684\u65b9\u6848\uff0c\u5e76\u8f93\u51fa\u5bf9\u5e94\u7684\u9762\u5305\u548c\u86cb\u631e\u6570\u91cf\u3002 \u5efa\u7acb\u6a21\u578b&#8230; <a class=\"read-more\" href=\"http:\/\/west.wangyuansheng.cn\/?p=205\">\u9605\u8bfb\u66f4\u591a&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-205","post","type-post","status-publish","format-standard","hentry","category-problem"],"_links":{"self":[{"href":"http:\/\/west.wangyuansheng.cn\/index.php?rest_route=\/wp\/v2\/posts\/205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/west.wangyuansheng.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/west.wangyuansheng.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/west.wangyuansheng.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/west.wangyuansheng.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=205"}],"version-history":[{"count":2,"href":"http:\/\/west.wangyuansheng.cn\/index.php?rest_route=\/wp\/v2\/posts\/205\/revisions"}],"predecessor-version":[{"id":360,"href":"http:\/\/west.wangyuansheng.cn\/index.php?rest_route=\/wp\/v2\/posts\/205\/revisions\/360"}],"wp:attachment":[{"href":"http:\/\/west.wangyuansheng.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/west.wangyuansheng.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=205"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/west.wangyuansheng.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}