75792024-01-09 20:31:56xxxToronyépítés (80 pont)cpp17Accepted 80/8012ms11156 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    int M = 20210108;
    vector<int> dp(n+100);
    dp[1] = 3, dp[2] = 10;
    for(int i = 3; i <= n; i++) {
        dp[i] = dp[i-1]*3 + dp[i-2];
        dp[i] %= M;
    }

    cout << dp[n] << '\n';


	return 0;
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1940 KiB
2Accepted0/03ms2192 KiB
3Accepted4/43ms2272 KiB
4Accepted4/43ms2524 KiB
5Accepted5/53ms2924 KiB
6Accepted5/53ms3088 KiB
7Accepted6/612ms10744 KiB
8Accepted6/64ms3908 KiB
9Accepted7/73ms3200 KiB
10Accepted7/73ms3348 KiB
11Accepted8/84ms4956 KiB
12Accepted8/812ms11156 KiB
13Accepted8/810ms10224 KiB
14Accepted8/86ms6068 KiB
15Accepted2/23ms3676 KiB
16Accepted2/23ms3792 KiB