6212021-11-04 20:47:08goczbaliToronyépítés (1,1,3,3)cpp14Wrong answer 38/5012ms9568 KiB
#include <iostream>
#include <vector>

using namespace std;

#define MOD 20210108

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

    vector<int> dp(n + 1);

    dp[0] = 1;

    for (int i = 1; i <= n; i++) {
        dp[i] = (dp[i - 1] * 2) % MOD;

        if (i >= 3) {
            dp[i] += (dp[i - 3] * 2) % MOD;
        }
    }

    cout << dp[n] << endl;
}
SubtaskSumTestVerdictTimeMemory
base38/50
1Accepted0/02ms1752 KiB
2Accepted0/01ms1852 KiB
3Accepted3/31ms1844 KiB
4Accepted3/31ms1840 KiB
5Wrong answer0/41ms1852 KiB
6Accepted4/41ms1856 KiB
7Accepted4/412ms9568 KiB
8Wrong answer0/42ms2596 KiB
9Accepted4/41ms1860 KiB
10Accepted4/41ms1868 KiB
11Accepted4/43ms3248 KiB
12Accepted4/412ms9540 KiB
13Accepted4/410ms8580 KiB
14Wrong answer0/44ms4356 KiB
15Accepted2/21ms1892 KiB
16Accepted2/21ms1908 KiB