59392023-10-06 01:32:15AncsaToronyépítés (1,1,3,3)cpp11Accepted 50/5012ms10868 KiB
#include <bits/stdc++.h>

using namespace std;


int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    a.at(0)=2;
    if (n>1)
       a.at(1)=4;
    if (n>2)
        a.at(2)=10;
    if (n>3)
    {
       for(int i=3;i<n;i++)
           a.at(i)=(2*(a.at(i-3)+a.at(i-1)))%20210108;
    }
    cout<<a.at(n-1);

    //for(long long int x:a)
     //   cout<<x<<" ";
    return 0;
}

SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1808 KiB
2Accepted0/02ms2068 KiB
3Accepted3/32ms2216 KiB
4Accepted3/32ms2296 KiB
5Accepted4/42ms2432 KiB
6Accepted4/42ms2512 KiB
7Accepted4/412ms10108 KiB
8Accepted4/44ms3484 KiB
9Accepted4/43ms2860 KiB
10Accepted4/42ms2940 KiB
11Accepted4/44ms4428 KiB
12Accepted4/412ms10868 KiB
13Accepted4/410ms10296 KiB
14Accepted4/46ms6088 KiB
15Accepted2/23ms3828 KiB
16Accepted2/22ms3928 KiB