17312022-12-02 11:02:41bzsofiaToronyépítés (1,1,3,3)cpp11Accepted 50/5016ms18640 KiB
#include <iostream>
#include <vector>

using namespace std;

long long i, n;

int main()
{
    cin>>n;

    vector <long long> x(n+4);

    x[1]=2;
    x[2]=4;
    x[3]=10;
    for(i=4; i<=n; ++i)
    {
        x[i]=(2*x[i-1]+2*x[i-3])%20210108;
    }

    cout<<x[n];

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1812 KiB
2Accepted0/02ms2024 KiB
3Accepted3/32ms2204 KiB
4Accepted3/32ms2412 KiB
5Accepted4/42ms2488 KiB
6Accepted4/42ms2612 KiB
7Accepted4/416ms18216 KiB
8Accepted4/44ms4696 KiB
9Accepted4/42ms3028 KiB
10Accepted4/42ms3100 KiB
11Accepted4/44ms6176 KiB
12Accepted4/416ms18640 KiB
13Accepted4/414ms16996 KiB
14Accepted4/47ms8808 KiB
15Accepted2/22ms3792 KiB
16Accepted2/22ms3860 KiB