3162021-10-06 15:32:57danimreToronyépítés (1,1,3,3)cpp14Elfogadva 50/5013ms9560 KiB
// njudgeTorony.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <cmath>
//#include <math.h> remainder(,)
using namespace std;
int Jk(int n)
{
    vector<int> solution(n + 1);
    solution[0] = 0;
    solution[1] = 2;
    solution[2] = 4;
    solution[3] = 10;
    for (size_t i = 4; i < n + 1; i++)
    {
        solution[i] = (2 * solution[i-1] + 2 * solution[i-3])%20210108;
    }
    return solution[n];
}
int main()
{
    int N;
    cin >> N;
    cout << Jk(N);
}

// 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/02ms1800 KiB
2Elfogadva0/01ms1916 KiB
3Elfogadva3/31ms1916 KiB
4Elfogadva3/31ms1912 KiB
5Elfogadva4/41ms1924 KiB
6Elfogadva4/41ms1920 KiB
7Elfogadva4/413ms9560 KiB
8Elfogadva4/42ms2660 KiB
9Elfogadva4/41ms1940 KiB
10Elfogadva4/41ms1948 KiB
11Elfogadva4/43ms3324 KiB
12Elfogadva4/413ms9552 KiB
13Elfogadva4/412ms8612 KiB
14Elfogadva4/44ms4376 KiB
15Elfogadva2/21ms1964 KiB
16Elfogadva2/21ms1960 KiB