134952025-01-08 08:45:40AGergoJárda-L (40)cpp17Accepted 40/401ms508 KiB
#include <bits/stdc++.h>

using namespace std;


int main()
{
    cin.tie(0);
    iostream::sync_with_stdio(0);

    int n;
    cin >> n;
    vector<int> sor(n+1);

    sor[0] = 0;
    sor[1] = 1;
    sor[2] = 2;
    sor[3] = 5;

    for(int i = 4; i <n+1;i++)
    {
        sor[i] = 2*sor[i-1] + sor[i-3];
    }

    cout << sor[n];
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms384 KiB
6Accepted2/21ms320 KiB
7Accepted2/21ms316 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms500 KiB
10Accepted3/31ms316 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms316 KiB
13Accepted3/31ms500 KiB
14Accepted3/31ms316 KiB
15Accepted3/31ms316 KiB
16Accepted3/31ms508 KiB
17Accepted3/31ms316 KiB