8012022-01-16 13:18:09Halasz EszterToronyépítés (1,1,3,3)cpp11Wrong answer 45/5059ms2020 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;
    if(n==2) cout<<4;
    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<<d<<"\n";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base45/50
1Accepted0/02ms1864 KiB
2Accepted0/01ms1956 KiB
3Accepted3/31ms1960 KiB
4Wrong answer0/31ms1972 KiB
5Accepted4/41ms1976 KiB
6Accepted4/41ms1980 KiB
7Accepted4/459ms1984 KiB
8Accepted4/48ms1996 KiB
9Accepted4/41ms1992 KiB
10Accepted4/41ms1996 KiB
11Accepted4/413ms2000 KiB
12Accepted4/457ms2012 KiB
13Accepted4/452ms2008 KiB
14Accepted4/419ms2004 KiB
15Accepted2/21ms2008 KiB
16Wrong answer0/21ms2020 KiB