77912024-01-11 10:15:56tamasmarkJárda-L (40)cpp17Accepted 40/403ms4308 KiB

#include <iostream>
#include <vector>

using namespace std;

int i, j, n;

int main()
{
    cin >> n;
    vector <unsigned long long> x(n + 4);

    x[0] = 1;
    x[1] = 1;
    x[2] = 2;
    x[3] = 5;
    for (i = 4; i <= n; ++i)
    {
        x[i] = x[i - 1] + x[i - 2];
        for (j = 0; j <= i-3; ++j)
        {
            x[i] += 2*x[j];
        }
    }

    cout << x[n];

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1812 KiB
2Accepted0/03ms2004 KiB
3Accepted2/23ms2212 KiB
4Accepted2/23ms2460 KiB
5Accepted2/23ms2644 KiB
6Accepted2/23ms2852 KiB
7Accepted2/23ms2936 KiB
8Accepted3/33ms3060 KiB
9Accepted3/33ms3296 KiB
10Accepted3/33ms3368 KiB
11Accepted3/33ms3580 KiB
12Accepted3/33ms3792 KiB
13Accepted3/33ms4000 KiB
14Accepted3/33ms4088 KiB
15Accepted3/33ms4200 KiB
16Accepted3/33ms4212 KiB
17Accepted3/33ms4308 KiB