14602022-10-16 10:58:25HorakZsofiToronyépítés (80 pont)cpp11Accepted 80/8017ms11032 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;
	dp[1]=3;
	const int hulyeszam=20210108;
	for(int i=2; 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/03ms1824 KiB
2Accepted0/02ms2160 KiB
3Accepted4/42ms2228 KiB
4Accepted4/42ms2436 KiB
5Accepted5/52ms2636 KiB
6Accepted5/52ms2848 KiB
7Accepted6/617ms10396 KiB
8Accepted6/64ms3764 KiB
9Accepted7/72ms3148 KiB
10Accepted7/72ms3224 KiB
11Accepted8/84ms4664 KiB
12Accepted8/817ms11032 KiB
13Accepted8/814ms10144 KiB
14Accepted8/87ms6052 KiB
15Accepted2/22ms3876 KiB
16Accepted2/22ms3756 KiB