31312023-02-19 12:14:24horvathabelToronyépítés (1,1,3,3)cpp17Accepted 50/5020ms11076 KiB
#include <bits/stdc++.h>
using namespace std;
int mod=20210108;
int main() {
	int n;
	cin>>n;
	vector<int> dp(n+1);
	dp[0]=1; 
	dp[1]=2;
	dp[2]=4;
	for (int i=3; i<=n;i++){
		dp[i]=dp[i-1]*2+dp[i-3]*2;
		dp[i]=dp[i]%mod;
	}
	cout<<dp[n];
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1808 KiB
2Accepted0/03ms2016 KiB
3Accepted3/32ms2096 KiB
4Accepted3/32ms2092 KiB
5Accepted4/43ms2336 KiB
6Accepted4/43ms2576 KiB
7Accepted4/420ms10548 KiB
8Accepted4/44ms3588 KiB
9Accepted4/43ms2860 KiB
10Accepted4/43ms3096 KiB
11Accepted4/46ms4536 KiB
12Accepted4/420ms11076 KiB
13Accepted4/418ms10176 KiB
14Accepted4/48ms5968 KiB
15Accepted2/23ms3572 KiB
16Accepted2/23ms3696 KiB