From f385d08b6d1c812e5271ca8b80d18beeea7cbfaa Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 9 May 2022 19:21:06 +0800 Subject: [PATCH] =?UTF-8?q?820.=20=E9=80=92=E5=BD=92=E6=B1=82=E6=96=90?= =?UTF-8?q?=E6=B3=A2=E9=82=A3=E5=A5=91=E6=95=B0=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acwing.com/problem/content/submission/code_detail/14063990/ --- AcWing/820/820.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 AcWing/820/820.cpp diff --git a/AcWing/820/820.cpp b/AcWing/820/820.cpp new file mode 100644 index 00000000..adcdd271 --- /dev/null +++ b/AcWing/820/820.cpp @@ -0,0 +1,20 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +int f(int x) { + return x == 1 || x == 2 ? 1 : f(x - 1) + f(x - 2); +} + +int n; + +int main() { + std::ios::sync_with_stdio(false); + + cin >> n; + cout << f(n) << endl; + + return 0; +}