87662024-01-29 15:20:23Balki22Toronyépítés (1,1,3,3)cpp17Accepted 50/5018ms18668 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	unsigned long long n; cin >> n;
	vector<unsigned long long> dp(n+1, 0);
	dp[0] = 1;
	dp[1] = 2;
	dp[2] = 4;
	for (unsigned long long i = 3; i <= n; i++) {
		dp[i] = ((2 * dp[i-1]) % 20210108 + (2 * dp[i-3]) % 20210108) % 20210108;
	}
	cout << dp[n];
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1680 KiB
2Accepted0/03ms1944 KiB
3Accepted3/33ms2144 KiB
4Accepted3/33ms2360 KiB
5Accepted4/42ms2384 KiB
6Accepted4/43ms2592 KiB
7Accepted4/418ms18200 KiB
8Accepted4/44ms4760 KiB
9Accepted4/43ms2968 KiB
10Accepted4/43ms3092 KiB
11Accepted4/46ms6144 KiB
12Accepted4/418ms18668 KiB
13Accepted4/417ms16932 KiB
14Accepted4/48ms8388 KiB
15Accepted2/22ms3396 KiB
16Accepted2/23ms3640 KiB