1532021-02-03 19:38:58Halasz EszterToronyépítés (1,1,3,3)cpp11Wrong answer 45/5092ms1960 KiB
#include <iostream>
//#include <fstream>

using namespace std;

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

long long n,i,a,b,c,d,e,M=20210108;

int main()
{
    cin>>n;
    if(n==1) cout<<2;
    if(n==2) cout<<4;
    if(n==3) cout<<10;
    else
    {
        a=2;
        b=2;
        c=4;
        d=10;
        for(i=4;i<=n;++i)
        {
            e=(((2*d)%M)+(2*b)%M)%M;
            a=b%M;
            b=c%M;
            c=d%M;
            d=e%M;
        }
        cout<<e;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base45/50
1Accepted0/02ms1804 KiB
2Accepted0/01ms1844 KiB
3Accepted3/32ms1904 KiB
4Wrong answer0/31ms1916 KiB
5Accepted4/42ms1924 KiB
6Accepted4/42ms1920 KiB
7Accepted4/492ms1924 KiB
8Accepted4/413ms1928 KiB
9Accepted4/41ms1932 KiB
10Accepted4/42ms1936 KiB
11Accepted4/414ms1932 KiB
12Accepted4/459ms1956 KiB
13Accepted4/452ms1940 KiB
14Accepted4/423ms1944 KiB
15Accepted2/21ms1956 KiB
16Wrong answer0/21ms1960 KiB