87652024-01-29 15:17:12Balki22Toronyépítés (80 pont)cpp17Accepted 80/8018ms18368 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] = 3;
	for (unsigned long long i = 2; i <= n; i++) {
		dp[i] = ((3 * dp[i-1]) % 20210108 + dp[i-2]) % 20210108;
	}
	cout << dp[n];
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1680 KiB
2Accepted0/03ms1948 KiB
3Accepted4/42ms2020 KiB
4Accepted4/43ms2140 KiB
5Accepted5/53ms2352 KiB
6Accepted5/53ms2480 KiB
7Accepted6/618ms18196 KiB
8Accepted6/64ms4500 KiB
9Accepted7/72ms2788 KiB
10Accepted7/73ms2880 KiB
11Accepted8/86ms5880 KiB
12Accepted8/818ms18368 KiB
13Accepted8/817ms16632 KiB
14Accepted8/88ms8108 KiB
15Accepted2/22ms3136 KiB
16Accepted2/23ms3168 KiB