30812023-02-14 13:06:27tamasmarkToronyépítés (1,1,3,3)cpp17Elfogadva 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
RészfeladatÖsszpontTesztVerdiktIdőMemória
base50/50
1Elfogadva0/03ms1880 KiB
2Elfogadva0/03ms1992 KiB
3Elfogadva3/33ms2184 KiB
4Elfogadva3/33ms2396 KiB
5Elfogadva4/43ms2604 KiB
6Elfogadva4/42ms2692 KiB
7Elfogadva4/414ms18204 KiB
8Elfogadva4/44ms4428 KiB
9Elfogadva4/43ms2816 KiB
10Elfogadva4/43ms3056 KiB
11Elfogadva4/44ms6308 KiB
12Elfogadva4/417ms18704 KiB
13Elfogadva4/414ms17228 KiB
14Elfogadva4/47ms8808 KiB
15Elfogadva2/23ms3940 KiB
16Elfogadva2/23ms4068 KiB