{"id":2748,"date":"2023-10-17T17:13:48","date_gmt":"2023-10-17T09:13:48","guid":{"rendered":"https:\/\/white-night.club\/?p=2748"},"modified":"2023-11-09T11:07:48","modified_gmt":"2023-11-09T03:07:48","slug":"ad67","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/17\/ad67\/","title":{"rendered":"\u722c\u697c\u68af\uff1a\u52a8\u6001\u89c4\u5212"},"content":{"rendered":"\n<p>\u76f4\u63a5\u8bf4\u201c\u722c\u697c\u68af\u201d\u95ee\u9898\u5176\u5b9e\u5c31\u662f\u201c\u6590\u6ce2\u90a3\u5951\u6570\u5217\u201d\u95ee\u9898\uff0c\u6211\u53cd\u6b63\u662f\u65e0\u6cd5\u7406\u89e3\u7684\u3002\u6240\u4ee5\u672c\u6587\u5c06\u8be6\u7ec6\u89e3\u91ca\u201c\u722c\u697c\u68af\u201d\u95ee\u9898\u662f\u600e\u4e48\u8f6c\u6362\u4e3a\u201c\u6590\u6ce2\u90a3\u5951\u6570\u5217\u201d\u95ee\u9898\u7684\u3002<\/p>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u722c\u697c\u68af<\/p>\n<cite><em>\u8fd8\u662f\u6590\u6ce2\u90a3\u5951\u6570\u5217\u95ee\u9898<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u5047\u8bbe\u4f60\u6b63\u5728\u722c\u697c\u68af\u3002\u9700\u8981&nbsp;<code>n<\/code>&nbsp;\u9636\u4f60\u624d\u80fd\u5230\u8fbe\u697c\u9876\u3002<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong><em>\u6bcf\u6b21\u4f60\u53ef\u4ee5\u722c&nbsp;<code>1<\/code>&nbsp;\u6216&nbsp;<code>2<\/code>&nbsp;\u4e2a\u53f0\u9636\u3002\u4f60\u6709\u591a\u5c11\u79cd\u4e0d\u540c\u7684\u65b9\u6cd5\u53ef\u4ee5\u722c\u5230\u697c\u9876\u5462\uff1f<\/em><\/strong><\/p>\n\n\n\n<p>\u4e3a\u4ec0\u4e48\u8fd9\u4e48\u8bf4\u662f\u6590\u6ce2\u90a3\u5951\u6570\u5217\u95ee\u9898\uff1f\u4e3e\u4e2a\u4f8b\u5b50\u3002\u5047\u8bbeF(n)\u4e3a\u722cn\u5c42\u697c\u68af\u7684\u65b9\u6cd5\u6570\u3002<\/p>\n\n\n\n<ul>\n<li>\u5047\u8bbe\u722c0\u5c42\u697c\u68af\n<ul>\n<li>\u53ea\u6709\u4e00\u79cd\u65b9\u6848\uff0cF(0)=1<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u5047\u8bbe\u722c1\u5c42\u697c\u68af\n<ul>\n<li>\u53ea\u80fd\u722c\u4e00\u5c42\uff0c\u8fd8\u662f\u53ea\u6709\u4e00\u79cd\u65b9\u6cd5\u3002F(1)=1<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u5047\u8bbe\u722c2\u5c42\u697c\u68af\n<ul>\n<li>\u5148\u722c\u4e00\u5c42\uff0c\u518d\u722c\u4e00\u5c42<\/li>\n\n\n\n<li>\u76f4\u63a5\u722c\u4e24\u5c42\uff0c\u5171\u4e24\u79cd\u65b9\u6848\u3002F(2)=2<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u5047\u8bbe\u722c3\u5c42\u697c\u68af\n<ul>\n<li>\u5148\u722c\u4e00\u5c42\uff0c\u5269\u4e0b2\u5c42\u6ca1\u722c\u3002\u800c<mark style=\"background-color:rgba(0, 0, 0, 0);color:#fcb900\" class=\"has-inline-color\">\u722c\u5269\u4e0b\u8fd9\u4e24\u5c42\u7684\u65b9\u6cd5\u6570\u90a3\u4e0d\u5c31\u662fF(2)<\/mark>\u5417\uff1f<\/li>\n\n\n\n<li>\u5148\u722c\u4e24\u5c42\uff0c\u5269\u4e0b1\u5c42\u6ca1\u722c\u3002\u90a3<mark style=\"background-color:rgba(0, 0, 0, 0);color:#fcb900\" class=\"has-inline-color\">\u5269\u4e0b\u8fd9\u4e00\u5c42\u7684\u65b9\u6cd5\u6570\u4e0d\u5c31\u662fF(1)<\/mark>\u5417\uff1f<\/li>\n\n\n\n<li>\u5148\u722c\u4e00\u5c42\u6216\u5148\u722c\u4e24\u5c42\u7684\u65b9\u6cd5\u6570\u603b\u548c\u5c31\u662fF(3)\uff0c\u5373F(2)+F(1)=F(3)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u5047\u8bbe\u722c4\u5c42\u697c\u68af\n<ul>\n<li>\u5148\u722c\u4e00\u5c42\uff0c\u5269\u4e0b3\u5c42\u6ca1\u722c\u3002\u722c\u5269\u4e0b\u8fd93\u5c42\u7684\u65b9\u6cd5\u6570\u5c31\u662fF(3)<\/li>\n\n\n\n<li>\u5148\u722c\u4e24\u5c42\uff0c\u5269\u4e0b2\u5c42\u6ca1\u722c\u3002\u722c\u5269\u4e0b\u8fd92\u5c42\u7684\u65b9\u6cd5\u6570\u5c31\u662fF(2)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>&#8230;<\/li>\n\n\n\n<li>\u5047\u8bbe\u722cn\u5c42\u697c\u68af\n<ul>\n<li>\u5148\u722c\u4e00\u5c42\uff0c\u5269\u4e0bn-1\u5c42\u6ca1\u722c\u3002\u722c\u5269\u4e0b\u8fd9n-1\u5c42\u7684\u65b9\u6cd5\u6570\u5c31\u662fF(n-1)<\/li>\n\n\n\n<li>\u5148\u722c\u4e24\u5c42\uff0c\u5269\u4e0bn-2\u5c42\u6ca1\u722c\u3002\u722c\u5269\u4e0b\u8fd9n-2\u5c42\u7684\u65b9\u6cd5\u6570\u5c31\u662fF(n-2)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>\u90a3\u4e48\u6700\u540eF(n)\u5c31\u7b49\u4e8e\u201c\u5148\u722c\u4e00\u5c42\u201d\u548c\u201c\u5148\u722c\u4e24\u5c42\u201d\u7684\u65b9\u6cd5\u6570\u603b\u548c<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong><em>F(n)=F(n-1)+F(n-2\uff09<\/em><\/strong><\/p>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\u8ba1\u7b97\u201c\u722c\u697c\u68af\u201d\u65b9\u6cd5\u6570\u4e5f\u662f\u4e00\u4e2a\u9012\u5f52\u7684\u8fc7\u7a0b\uff0c\u800c\u4e14\u548c\u6c42\u6590\u6ce2\u90a3\u5951\u6570\u5217\u51e0\u4e4e\u662f\u4e00\u6a21\u4e00\u6837\uff0c\u90fd\u662f\u4ece\u6c42F(n)\u5f00\u59cb\u5206\u5272\u51fa\u591a\u4e2a\u5b50\u95ee\u9898\uff0c\u7136\u540e\u5bf9\u6bcf\u4e2a\u5b50\u95ee\u9898\u6c42\u89e3\u3002<\/p>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u4ee3\u7801\u5b9e\u73b0<\/p>\n<cite><em>C++\u4ee3\u7801<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u5f53\u7136\u5b83\u9996\u5148\u662f\u9012\u5f52\u95ee\u9898\uff0c\u7136\u540e\u624d\u662f\u52a8\u6001\u89c4\u5212\u95ee\u9898\u3002\u90a3\u4e48\u9012\u5f52\uff0c\u8bb0\u5fc6\u6027\u641c\u7d22\u548c\u52a8\u6001\u89c4\u5212\u90fd\u662f\u53ef\u4ee5\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u3002\u8fd9\u91cc\u5c31\u53ea\u653e\u52a8\u6001\u89c4\u5212\u7684C++\u4ee3\u7801\u5427\u3002<\/p>\n\n\n\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c<mark style=\"background-color:rgba(0, 0, 0, 0);color:#fcb900\" class=\"has-inline-color\">\u722c\u7b2c0\u5c42\u4e5f\u7b97\u4e00\u79cd\u65b9\u6848\uff0c\u6240\u4ee5f(0)=1<\/mark>\u3002\u800c\u6590\u6ce2\u90a3\u5951\u6570\u5217\u7684f(0)=0<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;iostream&gt;\n#include&lt;vector&gt;\nusing namespace std;\n\nint fib(int n)\n{\n    if(n&lt;=1)\n    {\n        return 1;\n    }\n    int left=0,right=1;\n    int result=0;\n    for(int i=1;i&lt;=n;i++)\n    {\n        result=left+right;\n        left=right;\n        right=result;\n    }\n    return result;\n}\nint main()\n{\n    while(true)\n    {\n        int n;\n        cin&gt;&gt;n;\n        cout&lt;&lt;fib(n)&lt;&lt;endl;\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u53e6\u4e00\u79cd\u201c\u6590\u6ce2\u90a3\u5951\u6570\u5217\u201d<\/p>\n","protected":false},"author":1,"featured_media":3220,"comment_status":"open","ping_status":"","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[25,50],"tags":[102,36],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/2748"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=2748"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/2748\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/3220"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=2748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=2748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=2748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}