3912021-11-03 08:24:56TSomaToronyépítés (1,1,3,3)cpp11Accepted 50/5012ms9444 KiB
#include <iostream>
#include <vector>

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

    int N;
    std::cin >> N;

    std::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]);
            if (v[i] > 20210108) {
                v[i] %= 20210108;
            }
        }
        else
            v[i] = i * 2;
    }

    std::cout << v[N];
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1756 KiB
2Accepted0/01ms1800 KiB
3Accepted3/31ms1836 KiB
4Accepted3/31ms1836 KiB
5Accepted4/41ms1844 KiB
6Accepted4/41ms1840 KiB
7Accepted4/412ms9444 KiB
8Accepted4/43ms2556 KiB
9Accepted4/41ms1844 KiB
10Accepted4/41ms1840 KiB
11Accepted4/44ms3200 KiB
12Accepted4/412ms9440 KiB
13Accepted4/410ms8408 KiB
14Accepted4/44ms4240 KiB
15Accepted2/21ms1840 KiB
16Accepted2/21ms1840 KiB