122832024-12-11 11:31:38szasztundeToronyépítés (1,1,3,3)cpp17Accepted 50/508ms4168 KiB
#include <iostream>

using namespace std;
int a[1000001]={0};
int main()
{
    int n;
    cin>>n;
    a[1]=2; a[2]=4; a[3]=10;
    for(int i=4;i<=n;i++)
        a[i]=(2*a[i-1]+2*a[i-3])%20210108;
    cout<<a[n];
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms500 KiB
2Accepted0/01ms320 KiB
3Accepted3/31ms512 KiB
4Accepted3/31ms320 KiB
5Accepted4/41ms320 KiB
6Accepted4/41ms320 KiB
7Accepted4/48ms4080 KiB
8Accepted4/42ms824 KiB
9Accepted4/41ms320 KiB
10Accepted4/41ms320 KiB
11Accepted4/42ms1080 KiB
12Accepted4/48ms4168 KiB
13Accepted4/48ms3640 KiB
14Accepted4/44ms1592 KiB
15Accepted2/21ms320 KiB
16Accepted2/21ms500 KiB