67732023-12-19 09:05:26madvirToronyépítés (1,1,3,3)cpp17Accepted 50/5013ms18740 KiB
#include <iostream>

using namespace std;

int main()
{
    int n, x;
    cin >> n;
    long long a[n];
    a[0]=2;
    a[1]=4;
    a[2]=10;
    x=3;
    while(x<n) {
        a[x]=(2*a[x-1]+2*a[x-3])%20210108;
        x++;
    }
    if(n<x) {
        cout << a[n-1];
    }
    else {
        cout << a[--x];
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1916 KiB
2Accepted0/03ms2084 KiB
3Accepted3/33ms2428 KiB
4Accepted3/33ms2464 KiB
5Accepted4/43ms2616 KiB
6Accepted4/42ms2696 KiB
7Accepted4/413ms18444 KiB
8Accepted4/44ms5016 KiB
9Accepted4/42ms3116 KiB
10Accepted4/43ms3252 KiB
11Accepted4/44ms6444 KiB
12Accepted4/413ms18740 KiB
13Accepted4/412ms17108 KiB
14Accepted4/46ms8636 KiB
15Accepted2/23ms3464 KiB
16Accepted2/23ms3832 KiB