2042021-02-06 14:53:54kovacs.peter.18fToronyépítés (1,1,3,3)cpp11Accepted 50/5017ms14284 KiB
#include <iostream>
#include <vector>

using namespace std;

int main() {
    cin.sync_with_stdio(false);
    cin.tie(nullptr);

    int N;
    cin >> N;
    vector<int> variationS { 1, 2, 4 };
    for (int i = 3; i <= N; i++) {
        variationS.push_back(2 * (variationS[i - 1] + variationS[i - 3]) % 20210108);
    }
    cout << variationS[N] << '\n';
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1756 KiB
2Accepted0/01ms1816 KiB
3Accepted3/31ms1860 KiB
4Accepted3/31ms1860 KiB
5Accepted4/41ms1864 KiB
6Accepted4/41ms1872 KiB
7Accepted4/417ms14268 KiB
8Accepted4/43ms3612 KiB
9Accepted4/41ms1880 KiB
10Accepted4/41ms1888 KiB
11Accepted4/44ms5104 KiB
12Accepted4/416ms14284 KiB
13Accepted4/416ms14280 KiB
14Accepted4/46ms5112 KiB
15Accepted2/21ms1904 KiB
16Accepted2/21ms1916 KiB