59122023-10-05 16:10:20mmatedToronyépítés (1,1,3,3)cpp17Accepted 50/5013ms11032 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> torony(n+1,0);
    torony[0]=0;
    torony[1]=2;
    torony[2]=4;
    torony[3]=10;
    f(i,4,n+1)
    {
       torony[i]=(torony[i-1]*2 + torony[i-3]*2)%20210108;
    }
    cout<<torony[n]%20210108;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--)  solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1828 KiB
2Accepted0/03ms1876 KiB
3Accepted3/33ms2084 KiB
4Accepted3/32ms2172 KiB
5Accepted4/43ms2300 KiB
6Accepted4/43ms2544 KiB
7Accepted4/412ms10456 KiB
8Accepted4/44ms3784 KiB
9Accepted4/43ms3184 KiB
10Accepted4/43ms3240 KiB
11Accepted4/44ms4832 KiB
12Accepted4/413ms11032 KiB
13Accepted4/412ms10252 KiB
14Accepted4/46ms6308 KiB
15Accepted2/23ms3984 KiB
16Accepted2/23ms4136 KiB