3152021-10-06 15:29:44danimreToronyépítés (1,1,3,3)cpp14Wrong answer 0/50236ms4964 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;
    }
    for (size_t i = 0; i < n+1; i++)
    {
        cout << solution[i] << endl;
    }
    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
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/02ms1736 KiB
2Wrong answer0/03ms1788 KiB
3Wrong answer0/31ms1844 KiB
4Wrong answer0/31ms1848 KiB
5Wrong answer0/41ms1852 KiB
6Wrong answer0/41ms1856 KiB
7Time limit exceeded0/4232ms4964 KiB
8Wrong answer0/4158ms2740 KiB
9Wrong answer0/41ms1864 KiB
10Wrong answer0/41ms1868 KiB
11Time limit exceeded0/4236ms1984 KiB
12Time limit exceeded0/4228ms4952 KiB
13Time limit exceeded0/4231ms4504 KiB
14Time limit exceeded0/4232ms2408 KiB
15Wrong answer0/21ms1892 KiB
16Wrong answer0/21ms1892 KiB