15192022-11-21 21:33:14kicsiboglarJárda-L (40)cpp11Wrong answer 4/403ms3968 KiB
#include <iostream>
#include <vector>

#define ll long long
#define ull unsigned 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 <ull> dp(n+1);
    dp[0]=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/03ms1812 KiB
2Wrong answer0/02ms2056 KiB
3Accepted2/22ms2208 KiB
4Accepted2/22ms2448 KiB
5Wrong answer0/22ms2652 KiB
6Wrong answer0/22ms2732 KiB
7Wrong answer0/22ms2832 KiB
8Wrong answer0/32ms3032 KiB
9Wrong answer0/32ms3108 KiB
10Wrong answer0/32ms3388 KiB
11Wrong answer0/32ms3548 KiB
12Wrong answer0/32ms3676 KiB
13Wrong answer0/32ms3756 KiB
14Wrong answer0/32ms3804 KiB
15Wrong answer0/32ms3776 KiB
16Wrong answer0/32ms3904 KiB
17Wrong answer0/32ms3968 KiB