115022024-10-14 11:18:23horkaToronyépítés (1,1,3,3)cpp17Accepted 50/5016ms4152 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;
const int MOD=20210108;
int main() {
	int n; cin>>n;
	vector<int> dp(n+1);
	dp[0]=1;
	for(int i=1; i<=n; i++)
	{
		dp[i]=(dp[i-1]*2)%MOD;
		if(i>2) dp[i]=((dp[i-3])*2%MOD+dp[i])%MOD;
	}
	cout<<dp[n]<<"\n";
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms320 KiB
2Accepted0/01ms320 KiB
3Accepted3/31ms320 KiB
4Accepted3/31ms320 KiB
5Accepted4/41ms320 KiB
6Accepted4/41ms320 KiB
7Accepted4/416ms4152 KiB
8Accepted4/43ms824 KiB
9Accepted4/41ms320 KiB
10Accepted4/41ms496 KiB
11Accepted4/44ms1080 KiB
12Accepted4/416ms4152 KiB
13Accepted4/414ms3640 KiB
14Accepted4/46ms1720 KiB
15Accepted2/21ms320 KiB
16Accepted2/21ms320 KiB