79202024-01-12 07:00:15BenedekMartonToronyépítés (1,1,3,3)cpp17Accepted 50/5013ms10784 KiB
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    if(n==1){cout << 2; return 0;}
    if(n==2){cout << 4; return 0;}
    if(n==3){cout << 10; return 0;}
    int t[n];
    t[0]=2;
    t[1]=4;
    t[2]=10;
    for(int i=3; i<n; i++)
    {
        t[i]=(2*t[i-1]+2*t[i-3])%20210108;
    }
    cout << t[n-1];
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2004 KiB
3Accepted3/33ms2276 KiB
4Accepted3/33ms2344 KiB
5Accepted4/42ms2436 KiB
6Accepted4/43ms2444 KiB
7Accepted4/412ms10332 KiB
8Accepted4/44ms3652 KiB
9Accepted4/43ms2812 KiB
10Accepted4/43ms2864 KiB
11Accepted4/44ms4656 KiB
12Accepted4/413ms10784 KiB
13Accepted4/412ms9920 KiB
14Accepted4/46ms5768 KiB
15Accepted2/23ms3380 KiB
16Accepted2/23ms3624 KiB