8832022-01-25 09:35:03Halasz EszterToronyépítés (2,2,3,3)cpp11Accepted 40/404ms2008 KiB
#include <iostream>
//#include <fstream>

using namespace std;

//ifstream cin("toronyepites.in");
//ofstream cout("toronyepites.out");

int a,b,c,k,i,n,M=20210108;

int main()
{
    cin>>n;
    if(n==1) cout<<0;
    else if(n==2 || n==3) cout<<2;
    else if(n==4) cout<<4;
    else
    {
        a=2;
        b=2;
        c=4;
        for(i=5;i<=n;++i)
        {
            k=((2*a%M)%M+(2*b%M)%M)%M;
            a=b%M;
            b=c%M;
            c=k%M;
        }
        cout<<k;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/02ms1872 KiB
2Accepted0/01ms1896 KiB
3Accepted2/21ms1964 KiB
4Accepted2/21ms1964 KiB
5Accepted3/31ms1968 KiB
6Accepted3/31ms1976 KiB
7Accepted3/34ms1972 KiB
8Accepted3/33ms1976 KiB
9Accepted3/31ms1984 KiB
10Accepted3/31ms1992 KiB
11Accepted3/34ms1992 KiB
12Accepted3/34ms1996 KiB
13Accepted4/44ms2000 KiB
14Accepted4/43ms2000 KiB
15Accepted2/21ms2008 KiB
16Accepted2/21ms1908 KiB