37502023-03-02 18:36:51Erik_GepardToronyépítés (1,1,3,3)cpp17Accepted 50/5013ms11220 KiB
#include <bits/stdc++.h>
using namespace std;

const int mod = 20210108;

void solve(){
    int n;
    cin>>n;
    vector<int> dp(n+1, 0);
    dp[0]=0;
    dp[1]=2;
    dp[2]=4;
    dp[3]=10;
    for(int i=4; i<=n; i++){
        dp[i]=(dp[i-1]*2+dp[i-3]*2)%mod;
    }
    cout<<dp[n]%mod;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1828 KiB
2Accepted0/02ms2060 KiB
3Accepted3/32ms2136 KiB
4Accepted3/32ms2208 KiB
5Accepted4/42ms2428 KiB
6Accepted4/42ms2420 KiB
7Accepted4/413ms10260 KiB
8Accepted4/44ms3584 KiB
9Accepted4/42ms2848 KiB
10Accepted4/42ms2980 KiB
11Accepted4/44ms4652 KiB
12Accepted4/412ms11220 KiB
13Accepted4/412ms10280 KiB
14Accepted4/46ms6072 KiB
15Accepted2/22ms3696 KiB
16Accepted2/23ms3924 KiB