36902023-03-02 10:51:55KevinToronyépítés (80 pont)cpp17Accepted 80/8013ms10816 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> vec(n+1);
    vec[0]=1;
    vec[1]=3;
    for (int i=2; i<n+1; i++)
        vec[i]=(vec[i-1]*3+vec[i-2])%20210108;
    cout << vec[n]%20210108;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1812 KiB
2Accepted0/03ms2028 KiB
3Accepted4/42ms2100 KiB
4Accepted4/42ms2224 KiB
5Accepted5/52ms2444 KiB
6Accepted5/52ms2652 KiB
7Accepted6/612ms10332 KiB
8Accepted6/64ms3696 KiB
9Accepted7/72ms2952 KiB
10Accepted7/72ms3060 KiB
11Accepted8/84ms4300 KiB
12Accepted8/813ms10816 KiB
13Accepted8/810ms9720 KiB
14Accepted8/86ms5824 KiB
15Accepted2/22ms3380 KiB
16Accepted2/23ms3516 KiB