124882024-12-19 09:19:29ffteklaToronyépítés (1,1,3,3)cpp17Accepted 50/5013ms8208 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/01ms500 KiB
2Accepted0/01ms320 KiB
3Accepted3/31ms320 KiB
4Accepted3/31ms320 KiB
5Accepted4/41ms320 KiB
6Accepted4/41ms320 KiB
7Accepted4/413ms8208 KiB
8Accepted4/42ms1336 KiB
9Accepted4/41ms320 KiB
10Accepted4/41ms320 KiB
11Accepted4/43ms1848 KiB
12Accepted4/413ms7936 KiB
13Accepted4/412ms7224 KiB
14Accepted4/44ms3012 KiB
15Accepted2/21ms320 KiB
16Accepted2/21ms320 KiB