8912022-01-25 11:33:52Halasz EszterToronyépítés (1,1,3,3)cpp11Accepted 50/5059ms1956 KiB
#include <iostream>
//#include <fstream>

#define ll long long
using namespace std;

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

ll n,M=20210108,a,b,c,d,i;

int main()
{
    cin>>n;
    if(n==1) cout<<2;
    else if(n==2) cout<<4;
    else if(n==3) cout<<10;
    else
    {
        a=2;
        b=4;
        c=10;
        for(i=4;i<=n;++i)
        {
            d=((2*c%M)%M+(2*a%M)%M)%M;
            a=b%M;
            b=c%M;
            c=d%M;

        }
        cout<<c<<"\n";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1872 KiB
2Accepted0/01ms1888 KiB
3Accepted3/31ms1848 KiB
4Accepted3/31ms1952 KiB
5Accepted4/41ms1952 KiB
6Accepted4/41ms1848 KiB
7Accepted4/459ms1952 KiB
8Accepted4/48ms1848 KiB
9Accepted4/41ms1952 KiB
10Accepted4/41ms1852 KiB
11Accepted4/413ms1848 KiB
12Accepted4/457ms1848 KiB
13Accepted4/450ms1948 KiB
14Accepted4/420ms1952 KiB
15Accepted2/21ms1852 KiB
16Accepted2/21ms1956 KiB