From 144492f9d439ed59fa8955fdcc7a72480c8bf2a5 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Sun, 3 Jan 2021 21:38:43 +0800 Subject: [PATCH] =?UTF-8?q?P1990=20=E8=A6=86=E7=9B=96=E5=A2=99=E5=A3=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R44593612 --- Luogu/problem/P1990/P1990.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Luogu/problem/P1990/P1990.cpp diff --git a/Luogu/problem/P1990/P1990.cpp b/Luogu/problem/P1990/P1990.cpp new file mode 100644 index 00000000..03af7d28 --- /dev/null +++ b/Luogu/problem/P1990/P1990.cpp @@ -0,0 +1,15 @@ +#include + +using namespace std; + +int n, dp[1000009]; + +int main() { + dp[1] = 1, dp[2] = 2, dp[3] = 5; + cin >> n; + for (int i = 4; i <= n; i++) { + dp[i] = (dp[i - 1] * 2 + dp[i - 3]) % 10000; + } + cout << dp[n] << endl; + return 0; +} \ No newline at end of file