0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-18 06:52:00 +00:00
OI-codes/Luogu/P1990/P1990.cpp

15 lines
269 B
C++
Raw Normal View History

2021-01-03 13:38:43 +00:00
#include <bits/stdc++.h>
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;
}