14592022-10-16 10:56:03Zoli9Toronyépítés (80 pont)cpp17Accepted 80/8017ms10960 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	vector<int>dp(n+1);
	dp[0]=1;
	const int hulyeszam=20210108;
	for(int i=1; i<n+1; i++){
		dp[i]=(dp[i-2])%hulyeszam+(dp[i-1]*3)%hulyeszam;
		dp[i]=dp[i]%hulyeszam;
	}
	cout<<dp[n];
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1956 KiB
2Accepted0/02ms2156 KiB
3Accepted4/42ms2236 KiB
4Accepted4/42ms2436 KiB
5Accepted5/52ms2924 KiB
6Accepted5/52ms2808 KiB
7Accepted6/617ms10464 KiB
8Accepted6/64ms3836 KiB
9Accepted7/72ms3096 KiB
10Accepted7/72ms3340 KiB
11Accepted8/84ms4904 KiB
12Accepted8/817ms10960 KiB
13Accepted8/814ms10204 KiB
14Accepted8/87ms6152 KiB
15Accepted2/22ms3724 KiB
16Accepted2/22ms3940 KiB