3972021-11-03 08:29:42kovacs.peter.18fToronyépítés (1,1,3,3)cpp11Runtime error 26/503ms2864 KiB
#include <iostream>
#include <vector>

using namespace std;

int ans[100001]{ 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
base26/50
1Accepted0/02ms1916 KiB
2Accepted0/01ms1940 KiB
3Accepted3/31ms2000 KiB
4Accepted3/31ms2004 KiB
5Accepted4/41ms2004 KiB
6Accepted4/41ms2012 KiB
7Runtime error0/43ms2860 KiB
8Runtime error0/43ms2752 KiB
9Accepted4/41ms2004 KiB
10Accepted4/42ms2008 KiB
11Runtime error0/43ms2860 KiB
12Runtime error0/43ms2760 KiB
13Runtime error0/43ms2864 KiB
14Runtime error0/43ms2756 KiB
15Accepted2/21ms2008 KiB
16Accepted2/22ms2008 KiB