15432022-11-22 23:44:11TomaSajtToronyépítés (2,2,3,3)cpp14Accepted 40/404ms5204 KiB
#include <bits/stdc++.h>
#define speed ios::sync_with_stdio(0);cin.tie(0)
using namespace std;

int main() {
    speed;
    int n; cin >> n;
    vector<int> dp(n + 1);
    dp[0] = 1;
    for (int i = 1; i <= n; i++) {
        if (i >= 2) dp[i] += 2 * dp[i - 2];
        if (i >= 3) dp[i] += 2 * dp[i - 3];
        dp[i] %= 20210108;
    }
    cout << dp[n];
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1708 KiB
2Accepted0/02ms1868 KiB
3Accepted2/22ms2068 KiB
4Accepted2/22ms2272 KiB
5Accepted3/32ms2656 KiB
6Accepted3/32ms2520 KiB
7Accepted3/33ms4052 KiB
8Accepted3/33ms3864 KiB
9Accepted3/32ms3244 KiB
10Accepted3/32ms3484 KiB
11Accepted3/33ms4872 KiB
12Accepted3/34ms4996 KiB
13Accepted4/43ms5204 KiB
14Accepted4/43ms4760 KiB
15Accepted2/22ms4084 KiB
16Accepted2/22ms4040 KiB