87632024-01-29 15:12:41Balki22Toronyépítés (80 pont)cpp17Runtime error 78/8018ms18492 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	unsigned long long n; cin >> n;
	vector<unsigned long long> dp(n, 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
base78/80
1Runtime error0/03ms1920 KiB
2Runtime error0/03ms2188 KiB
3Accepted4/43ms2252 KiB
4Accepted4/43ms2488 KiB
5Accepted5/53ms2700 KiB
6Accepted5/53ms2884 KiB
7Accepted6/618ms18492 KiB
8Accepted6/64ms4848 KiB
9Accepted7/73ms3196 KiB
10Accepted7/72ms3272 KiB
11Accepted8/86ms6160 KiB
12Accepted8/818ms18380 KiB
13Accepted8/817ms16696 KiB
14Accepted8/88ms8276 KiB
15Runtime error0/23ms3264 KiB
16Accepted2/23ms3424 KiB