124662024-12-18 11:25:45szasztundeToronyépítés (1,1,3,3)cpp17Accepted 50/507ms404 KiB
#include <iostream>

using namespace std;

int main()
{
    int n,f1=2,f2=4,f3=10,f4;
    cin>>n;
    if(n==1) cout<<2;
    else if(n==2) cout<<4;
    else if (n==3) cout<<10;
    else{
    for(int i=4;i<=n;i++)
    {
        f4=(2*f3+2*f1)%20210108;
        f1=f2;
        f2=f3;
        f3=f4;
    }
    cout<<f4;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms320 KiB
2Accepted0/01ms320 KiB
3Accepted3/31ms320 KiB
4Accepted3/31ms320 KiB
5Accepted4/41ms320 KiB
6Accepted4/41ms320 KiB
7Accepted4/47ms400 KiB
8Accepted4/41ms332 KiB
9Accepted4/41ms320 KiB
10Accepted4/41ms320 KiB
11Accepted4/42ms364 KiB
12Accepted4/46ms404 KiB
13Accepted4/46ms320 KiB
14Accepted4/43ms320 KiB
15Accepted2/21ms320 KiB
16Accepted2/21ms320 KiB