4002021-11-03 08:30:29kovacs.peter.18fToronyépítés (1,1,3,3)cpp11Accepted 50/5012ms9752 KiB
#include <iostream>
#include <vector>

using namespace std;

int ans[1000001]{ 1, 2, 4 };

vector<int> variationS;

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

    int N;
    cin >> N;
    for (int i = 3; i <= N; i++) {
        ans[i] = 2 * (ans[i - 1] + ans[i - 3]) % 20210108;
    }
    cout << ans[N] << '\n';
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1996 KiB
2Accepted0/01ms2040 KiB
3Accepted3/31ms2044 KiB
4Accepted3/31ms2028 KiB
5Accepted4/42ms2060 KiB
6Accepted4/41ms2064 KiB
7Accepted4/412ms9752 KiB
8Accepted4/43ms2924 KiB
9Accepted4/42ms2072 KiB
10Accepted4/41ms2088 KiB
11Accepted4/44ms3612 KiB
12Accepted4/412ms9720 KiB
13Accepted4/410ms8824 KiB
14Accepted4/44ms4660 KiB
15Accepted2/21ms2108 KiB
16Accepted2/21ms2104 KiB