4722021-11-03 17:42:50SzankaBenedekToronyépítés (1,1,3,3)cpp11Accepted 50/5010ms2040 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    cin.sync_with_stdio(false);
    cin.tie(nullptr);

    int input;
    cin >> 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";

    int a = 2;
    int b = 4;
    int c = 10;
    
    for (int n = 3; n < input; n += 3)
    {
        a = (2 * c + 2 * a) % 20210108;
        b = (2 * a + 2 * b) % 20210108;
        c = (2 * b + 2 * c) % 20210108;
    }
    char asd = input % 3;
    if (asd == 0)
    {
        cout << c << "\n";
        return 0;
    }
    if (asd == 1)
    {
        cout << a << "\n";
        return 0;
    }
    if (asd == 2)
    {
        cout << b << "\n";
        return 0;
    }
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/010ms1884 KiB
2Accepted0/01ms1948 KiB
3Accepted3/31ms1988 KiB
4Accepted3/31ms1992 KiB
5Accepted4/41ms1996 KiB
6Accepted4/41ms2000 KiB
7Accepted4/46ms2004 KiB
8Accepted4/42ms2012 KiB
9Accepted4/41ms2016 KiB
10Accepted4/41ms2016 KiB
11Accepted4/42ms2024 KiB
12Accepted4/47ms2028 KiB
13Accepted4/46ms2028 KiB
14Accepted4/43ms2032 KiB
15Accepted2/21ms2040 KiB
16Accepted2/21ms2040 KiB