131132025-01-06 16:35:35ercseferencJárda-L (40)cpp17Accepted 40/401ms508 KiB
#include <iostream>
using namespace std;
long long a[29];
int main()
{
    int n; cin>>n;
    long long a[29];
    a[0]=0; a[1]=1; a[2]=2; a[3]=5;
    long long s;
    for(int i=4; i<=28; i++){
        s=2+a[i-1]+a[i-2];
        for(int j=1; j<i-2; j++){s+=2*a[j];}
        a[i]=s;}
    cout<<a[n];
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms316 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms508 KiB
10Accepted3/31ms316 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms316 KiB
13Accepted3/31ms316 KiB
14Accepted3/31ms316 KiB
15Accepted3/31ms316 KiB
16Accepted3/31ms316 KiB
17Accepted3/31ms316 KiB