15172022-11-21 21:29:42kicsiboglarJárda-L (40)cpp11Wrong answer 4/403ms3808 KiB
#include <iostream>
#include <vector>

#define ll long long
using namespace std;

//ifstream cin ("input.in");
//ofstream cout ("output.out");

ll n,m,i,j,a,b,k;

int main()
{

    cin>>n;
    if (n==1) 
    {
        cout<<"1";
        return 0;
    }
    if (n==2) 
    {
        cout<<"2";
        return 0;
    }
    if (n==3) 
    {
        cout<<"5";
        return 0;
    }
    vector <ll> dp(n+1);
    dp[1]=1;
    dp[2]=2;
    dp[3]=5;
    for (i=4;i<=n;++i)
    {
        dp[i]=dp[i-1]+dp[i-2];
        j=i-3;
        while (j>=1) 
        {
            dp[i]+=dp[j]*2;
            j--;
        }
    }
    cout<<dp[n];
}
SubtaskSumTestVerdictTimeMemory
base4/40
1Accepted0/03ms1680 KiB
2Wrong answer0/02ms1852 KiB
3Accepted2/22ms2092 KiB
4Accepted2/22ms2292 KiB
5Wrong answer0/22ms2536 KiB
6Wrong answer0/22ms2740 KiB
7Wrong answer0/22ms2904 KiB
8Wrong answer0/32ms3108 KiB
9Wrong answer0/32ms3464 KiB
10Wrong answer0/32ms3424 KiB
11Wrong answer0/32ms3424 KiB
12Wrong answer0/32ms3356 KiB
13Wrong answer0/32ms3488 KiB
14Wrong answer0/32ms3564 KiB
15Wrong answer0/32ms3568 KiB
16Wrong answer0/32ms3692 KiB
17Wrong answer0/32ms3808 KiB