59142023-10-05 16:28:05mmatedToronyépítés (2,2,3,3)cpp17Accepted 40/404ms4900 KiB
#include <bits/stdc++.h>
using namespace std;
#define f(i,k,n) for(int i=k; i<n; i++)
#define ll long long
const int inf = INT_MAX;

void solve()
{
    int n;
    cin>>n;
    vector<int> a(n+1,0);
    a[0]=2;
    a[1]=2;
    a[2]=4;
    f(i,3,n+1)  a[i]=(a[i-2]*2 + a[i-3]*2)%20210108;
    cout<<a[n-2]%20210108;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--)  solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms2016 KiB
2Accepted0/03ms2108 KiB
3Accepted2/22ms2324 KiB
4Accepted2/22ms2332 KiB
5Accepted3/32ms2336 KiB
6Accepted3/32ms2340 KiB
7Accepted3/34ms3684 KiB
8Accepted3/33ms3360 KiB
9Accepted3/33ms2708 KiB
10Accepted3/32ms2920 KiB
11Accepted3/34ms4436 KiB
12Accepted3/34ms4648 KiB
13Accepted4/44ms4900 KiB
14Accepted4/43ms4468 KiB
15Accepted2/23ms3832 KiB
16Accepted2/23ms4060 KiB