7992022-01-16 13:13:44Halasz EszterToronyépítés (1,1,3,3)cpp11Wrong answer 45/5021ms2024 KiB
#include <iostream>
//#include <fstream>

using namespace std;

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

int 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;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base45/50
1Accepted0/02ms1864 KiB
2Accepted0/01ms1908 KiB
3Accepted3/31ms1976 KiB
4Wrong answer0/31ms1976 KiB
5Accepted4/41ms1976 KiB
6Accepted4/41ms1980 KiB
7Accepted4/421ms1984 KiB
8Accepted4/44ms1992 KiB
9Accepted4/41ms1996 KiB
10Accepted4/41ms2000 KiB
11Accepted4/46ms2004 KiB
12Accepted4/421ms2008 KiB
13Accepted4/419ms2008 KiB
14Accepted4/48ms2012 KiB
15Accepted2/21ms2020 KiB
16Wrong answer0/21ms2024 KiB