3752021-11-03 08:14:30TSomaToronyépítés (1,1,3,3)cpp11Accepted 50/5014ms9444 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N;
    cin >> N;

    vector<int> v(N+1);
    v[0] = 1;

    for (size_t i = 1; i < N+1; i++)
    {        
        if (i > 2)
            v[i] = (2 * v[i - 1] + 2 * v[i - 3]) % 20210108;
        else
            v[i] = i * 2;
    }

    cout << v[N];
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1736 KiB
2Accepted0/01ms1768 KiB
3Accepted3/31ms1828 KiB
4Accepted3/31ms1824 KiB
5Accepted4/41ms1824 KiB
6Accepted4/41ms1824 KiB
7Accepted4/414ms9440 KiB
8Accepted4/43ms2552 KiB
9Accepted4/41ms1720 KiB
10Accepted4/41ms1720 KiB
11Accepted4/44ms3204 KiB
12Accepted4/413ms9444 KiB
13Accepted4/410ms8404 KiB
14Accepted4/44ms4244 KiB
15Accepted2/21ms1824 KiB
16Accepted2/21ms1720 KiB