139322025-01-09 11:36:20kongopongJárda-L (40)cpp17Accepted 40/401ms564 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    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; i++)
    {
        sor[i]=2*sor[i-1] + sor[i-3];
    }
    cout << sor[n];

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/01ms508 KiB
2Accepted0/01ms316 KiB
3Accepted2/21ms508 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms316 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms316 KiB
10Accepted3/31ms564 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms316 KiB
13Accepted3/31ms316 KiB
14Accepted3/31ms316 KiB
15Accepted3/31ms508 KiB
16Accepted3/31ms316 KiB
17Accepted3/31ms316 KiB