4072021-11-03 08:36:45IpiGeriToronyépítés (1,1,3,3)cpp11Accepted 50/5012ms9528 KiB
// toronyepites_11.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> dolgok(M + 1);

    dolgok[0] = 0 % 20210108;
    dolgok[1] = 2 % 20210108;
    dolgok[2] = 4 % 20210108;
    dolgok[3] = 10 % 20210108;

    if (M < 4)
    {
        cout << dolgok[M];
        return 0;
    }

    for (size_t i = 4; i <= M; i++)
    {
        dolgok[i] = (2 * dolgok[i - 1] + 2 * dolgok[i - 3]) % 20210108;
    }

    cout << dolgok[M];
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1740 KiB
2Accepted0/01ms1772 KiB
3Accepted3/31ms1720 KiB
4Accepted3/31ms1824 KiB
5Accepted4/41ms1828 KiB
6Accepted4/41ms1720 KiB
7Accepted4/412ms9528 KiB
8Accepted4/42ms2552 KiB
9Accepted4/41ms1828 KiB
10Accepted4/41ms1824 KiB
11Accepted4/43ms3204 KiB
12Accepted4/412ms9472 KiB
13Accepted4/410ms8512 KiB
14Accepted4/44ms4280 KiB
15Accepted2/21ms1720 KiB
16Accepted2/21ms1720 KiB