3872021-11-03 08:23:05SzankaBenedekToronyépítés (1,1,3,3)cpp11Wrong answer 18/508ms9504 KiB
#include <iostream>
#include <vector>

using namespace std;

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

int main()
{
    int a;
    cin >> a;
    cout << f(a) << "\n";
}
SubtaskSumTestVerdictTimeMemory
base18/50
1Accepted0/02ms1800 KiB
2Wrong answer0/01ms1832 KiB
3Accepted3/31ms1888 KiB
4Accepted3/31ms1784 KiB
5Runtime error0/42ms1872 KiB
6Runtime error0/41ms1880 KiB
7Wrong answer0/47ms9504 KiB
8Wrong answer0/42ms2612 KiB
9Accepted4/41ms1888 KiB
10Accepted4/41ms1784 KiB
11Wrong answer0/43ms3264 KiB
12Wrong answer0/48ms9500 KiB
13Wrong answer0/48ms8460 KiB
14Wrong answer0/44ms4304 KiB
15Accepted2/21ms1888 KiB
16Accepted2/21ms1892 KiB