4452021-11-03 13:32:40SzankaBenedekToronyépítés (1,1,3,3)cpp11Accepted 50/509ms9700 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int input;
    cin >> input;

    // vector<int> v(input);
    int v[input];
    v[0] = 2;
    v[1] = 4;
    v[2] = 10; //8+2
    for (int n = 3; n < input; n++)
    {
        v[n] = (2 * v[n - 1] + 2 * v[n - 3]) % 20210108;
    }

    cout << v[input - 1] << "\n";
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1872 KiB
2Accepted0/01ms1896 KiB
3Accepted3/31ms1952 KiB
4Accepted3/31ms1848 KiB
5Accepted4/41ms1956 KiB
6Accepted4/41ms1848 KiB
7Accepted4/49ms9700 KiB
8Accepted4/42ms2812 KiB
9Accepted4/41ms1956 KiB
10Accepted4/41ms1952 KiB
11Accepted4/43ms3504 KiB
12Accepted4/49ms9644 KiB
13Accepted4/48ms8696 KiB
14Accepted4/44ms4544 KiB
15Accepted2/21ms1956 KiB
16Accepted2/21ms1952 KiB