4242021-11-03 09:00:02kovacs.peter.18fToronyépítés (1,1,3,3)cpp11Runtime error 48/5012ms9592 KiB
#include <iostream>

using namespace std;

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

    int N;
    cin >> N;
    int* ans = new int[N + 1]{ 1, 2, 4 };
    for (int i = 3; i <= N; i++) {
        ans[i] = 2 * (ans[i - 1] + ans[i - 3]);
        if (ans[i] > 20210108) ans[i] %= 20210108;
    }
    cout << ans[N] << '\n';
}
SubtaskSumTestVerdictTimeMemory
base48/50
1Accepted0/02ms1768 KiB
2Accepted0/02ms1784 KiB
3Accepted3/32ms1840 KiB
4Accepted3/31ms1836 KiB
5Accepted4/41ms1836 KiB
6Accepted4/41ms1836 KiB
7Accepted4/412ms9592 KiB
8Accepted4/42ms2832 KiB
9Accepted4/41ms1844 KiB
10Accepted4/41ms1836 KiB
11Accepted4/43ms3404 KiB
12Accepted4/412ms9536 KiB
13Accepted4/49ms8716 KiB
14Accepted4/44ms4436 KiB
15Accepted2/21ms1836 KiB
16Runtime error0/24ms2240 KiB