150682025-02-12 09:10:07SMC40Toronyépítés (1,1,3,3)cpp17Accepted 50/5048ms8092 KiB
#include <bits/stdc++.h>
using namespace std;
int MOD=20210108;

int main() {
	int n;
    cin >>n;
    vector<long long> dp(n+1,0);
    dp[0]=1;
    for(int i=1;i<=n;i++){
        dp[i]=(dp[i]+dp[i-1]*2)%MOD;
        if(i>=3){
            dp[i]=(dp[i]+dp[i-3]*2)%MOD;
        }
    }
    cout <<dp[n];
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted3/31ms316 KiB
4Accepted3/31ms316 KiB
5Accepted4/41ms316 KiB
6Accepted4/41ms316 KiB
7Accepted4/448ms8092 KiB
8Accepted4/47ms1332 KiB
9Accepted4/41ms320 KiB
10Accepted4/41ms404 KiB
11Accepted4/410ms1852 KiB
12Accepted4/448ms7988 KiB
13Accepted4/443ms7220 KiB
14Accepted4/417ms3052 KiB
15Accepted2/21ms316 KiB
16Accepted2/21ms316 KiB