115072024-10-14 11:21:42fazekas2028cToronyépítés (1,1,3,3)cpp17Accepted 50/5018ms8192 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long
const int MOD = 20210108;

signed main() {
	int n; 
	cin >> n;
	vector<int> dp(n+1, 0);
	dp[0] = 1;
	dp[1] = 2;
	dp[2] = 4;
	for (int i = 3; i <= n; i++) {
		dp[i] = ((2 * dp[i-1]) % MOD + (2 * dp[i-3]) % MOD) % MOD;
	}
	cout << dp[n];
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms320 KiB
2Accepted0/01ms320 KiB
3Accepted3/31ms508 KiB
4Accepted3/31ms320 KiB
5Accepted4/41ms320 KiB
6Accepted4/41ms320 KiB
7Accepted4/418ms8192 KiB
8Accepted4/43ms1212 KiB
9Accepted4/41ms320 KiB
10Accepted4/41ms320 KiB
11Accepted4/44ms2004 KiB
12Accepted4/417ms8148 KiB
13Accepted4/416ms7060 KiB
14Accepted4/47ms2872 KiB
15Accepted2/21ms320 KiB
16Accepted2/21ms500 KiB