124972024-12-19 11:33:21nkbalintToronyépítés (1,1,3,3)cpp17Accepted 50/5013ms8164 KiB
#include <iostream>

using namespace std;

int n,i;
long long v[1000001];

int main()
{
    cin>>n;
    v[1]=2;
    v[2]=4;
    v[3]=10;
    if(n>3)
    {
        for(i=4;i<=n;++i)
        {
            v[i]=(2*v[i-1]+2*v[i-3])%20210108;
        }
    }
    cout<<v[n];
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms320 KiB
2Accepted0/01ms320 KiB
3Accepted3/31ms320 KiB
4Accepted3/31ms320 KiB
5Accepted4/41ms320 KiB
6Accepted4/41ms320 KiB
7Accepted4/413ms8164 KiB
8Accepted4/42ms1348 KiB
9Accepted4/41ms320 KiB
10Accepted4/41ms320 KiB
11Accepted4/43ms1944 KiB
12Accepted4/413ms8100 KiB
13Accepted4/410ms7016 KiB
14Accepted4/44ms2872 KiB
15Accepted2/21ms320 KiB
16Accepted2/21ms320 KiB