59912023-10-11 16:18:44KCsengeToronyépítés (1,1,3,3)cpp14Accepted 50/5010ms11472 KiB
#include <iostream>

using namespace std;

int main()
{
    int n,o;
    cin>>n;
    int tomb[n+1];
    tomb[1]=2;
    tomb[2]=4;
    tomb[3]=10;

    for(int i=4;i<=n;i++)
    {
        tomb[i]=(2*tomb[i-1]+2*tomb[i-3])%20210108;
    }
    cout<<tomb[n];
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/02ms2124 KiB
3Accepted3/32ms2356 KiB
4Accepted3/33ms2580 KiB
5Accepted4/43ms2800 KiB
6Accepted4/43ms3000 KiB
7Accepted4/410ms11052 KiB
8Accepted4/44ms4384 KiB
9Accepted4/42ms3476 KiB
10Accepted4/42ms3564 KiB
11Accepted4/44ms5136 KiB
12Accepted4/410ms11472 KiB
13Accepted4/49ms10864 KiB
14Accepted4/44ms6740 KiB
15Accepted2/22ms4076 KiB
16Accepted2/22ms4076 KiB