125692024-12-23 13:26:15vauvau6Toronyépítés (1,1,3,3)cpp17Accepted 50/5013ms8112 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/01ms512 KiB
2Accepted0/01ms320 KiB
3Accepted3/31ms320 KiB
4Accepted3/31ms320 KiB
5Accepted4/41ms320 KiB
6Accepted4/41ms320 KiB
7Accepted4/413ms8044 KiB
8Accepted4/42ms1336 KiB
9Accepted4/41ms320 KiB
10Accepted4/41ms320 KiB
11Accepted4/43ms1848 KiB
12Accepted4/413ms8112 KiB
13Accepted4/410ms7104 KiB
14Accepted4/44ms2872 KiB
15Accepted2/21ms320 KiB
16Accepted2/21ms320 KiB