125682024-12-23 13:25:16vauvau6Toronyépítés (1,1,3,3)cpp17Wrong answer 0/501ms548 KiB
#include <iostream>
#include <vector>

using namespace std;

int i,v[29],n;
int main()
{
    cin>>n;
    v[1]=1;
    v[2]=2;
    v[3]=5;
    v[4]=11;
    if(n>4)
    {
        for(i=5;i<=n;++i)
        {
            v[i]=v[i-1]*2+v[i-3];
        }
    }
    cout<<v[n];
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/01ms320 KiB
2Runtime error0/01ms320 KiB
3Wrong answer0/31ms320 KiB
4Wrong answer0/31ms320 KiB
5Wrong answer0/41ms320 KiB
6Wrong answer0/41ms320 KiB
7Runtime error0/41ms320 KiB
8Runtime error0/41ms320 KiB
9Wrong answer0/41ms320 KiB
10Wrong answer0/41ms320 KiB
11Runtime error0/41ms548 KiB
12Runtime error0/41ms320 KiB
13Runtime error0/41ms320 KiB
14Runtime error0/41ms320 KiB
15Wrong answer0/21ms320 KiB
16Wrong answer0/21ms320 KiB