30812023-02-14 13:06:27tamasmarkToronyépítés (1,1,3,3)cpp17Accepted 50/5017ms18704 KiB
// torony.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>

using namespace std;

long long i, n;
vector<long long>x;

int main()
{
    cin >> n;
    x.resize(n+4);
    x[1] = 2;
    x[2] = 4;
    x[3] = 10;
    for (i = 4; i <= n; ++i)
    {
        x[i] = (2 * x[i - 1] + 2 * x[i - 3]) % 20210108;
    }
    cout << x[n];
    return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1880 KiB
2Accepted0/03ms1992 KiB
3Accepted3/33ms2184 KiB
4Accepted3/33ms2396 KiB
5Accepted4/43ms2604 KiB
6Accepted4/42ms2692 KiB
7Accepted4/414ms18204 KiB
8Accepted4/44ms4428 KiB
9Accepted4/43ms2816 KiB
10Accepted4/43ms3056 KiB
11Accepted4/44ms6308 KiB
12Accepted4/417ms18704 KiB
13Accepted4/414ms17228 KiB
14Accepted4/47ms8808 KiB
15Accepted2/23ms3940 KiB
16Accepted2/23ms4068 KiB