4012021-11-03 08:31:13kovacs.peter.18fToronyépítés (1,1,3,3)cpp11Accepted 50/5013ms9648 KiB
#include <iostream>

using namespace std;

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

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/02ms1848 KiB
2Accepted0/01ms1888 KiB
3Accepted3/31ms1940 KiB
4Accepted3/31ms1940 KiB
5Accepted4/41ms1936 KiB
6Accepted4/41ms1940 KiB
7Accepted4/413ms9648 KiB
8Accepted4/43ms2776 KiB
9Accepted4/41ms1932 KiB
10Accepted4/41ms1936 KiB
11Accepted4/44ms3472 KiB
12Accepted4/413ms9608 KiB
13Accepted4/410ms8664 KiB
14Accepted4/44ms4504 KiB
15Accepted2/21ms1940 KiB
16Accepted2/21ms1936 KiB