4052021-11-03 08:34:07LefantiVilmosToronyépítés (1,1,3,3)cpp11Accepted 50/5013ms9508 KiB
#include <iostream>
#include <vector>

long long torony(int);

using namespace std;
int main()
{
    int n;
    cin >> n;

    cout << torony(n);
    



}

long long torony(int n)
{
    vector<int> lista(n + 3);
    lista[1] = 2;
    lista[2] = 4;
    lista[3] = 10;

    int eredmeny;

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


    return lista[n];
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1804 KiB
2Accepted0/01ms1864 KiB
3Accepted3/31ms1888 KiB
4Accepted3/31ms1888 KiB
5Accepted4/41ms1784 KiB
6Accepted4/41ms1892 KiB
7Accepted4/413ms9504 KiB
8Accepted4/42ms2612 KiB
9Accepted4/41ms1892 KiB
10Accepted4/41ms1784 KiB
11Accepted4/44ms3260 KiB
12Accepted4/413ms9508 KiB
13Accepted4/410ms8464 KiB
14Accepted4/44ms4304 KiB
15Accepted2/21ms1888 KiB
16Accepted2/21ms1888 KiB