141752025-01-10 08:12:10TundeJárda-L (40)cpp17Accepted 40/401ms508 KiB
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int t[n+1];
    for(int i=1; i<=n; i++)
    {
        if(i==1)
        {
            t[i]=1;
        }
        if(i==2)
        {
            t[i]=2;
        }
        if(i==3)
        {
            t[i]=5;
        }
        if(i>3)
        {
            t[i]=2*t[i-1]+t[i-3];
        }
    }
    cout << t[n];
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms500 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms316 KiB
8Accepted3/31ms508 KiB
9Accepted3/31ms316 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