245862026-02-12 21:07:00999Toronyépítés (1,1,3,3)cpp17Accepted 50/5013ms8144 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;
#define int long long

const int MOD=20210108;

signed 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]%=MOD;
    }
    cout<<dp[n];
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms508 KiB
2Accepted0/02ms316 KiB
3Accepted3/31ms316 KiB
4Accepted3/31ms316 KiB
5Accepted4/41ms316 KiB
6Accepted4/41ms508 KiB
7Accepted4/413ms8016 KiB
8Accepted4/42ms1332 KiB
9Accepted4/41ms316 KiB
10Accepted4/41ms388 KiB
11Accepted4/43ms1936 KiB
12Accepted4/413ms8144 KiB
13Accepted4/413ms7136 KiB
14Accepted4/44ms3012 KiB
15Accepted2/21ms316 KiB
16Accepted2/21ms316 KiB