递推50分蒟蒻求助(目前T5个)

P1255 数楼梯

阴语飞 @ 2022-06-19 10:36:57

#include<bits/stdc++.h>
using namespace std;
int ct(int x,int n)
{
    if(x==n)
    {
        return 1;
    }
    if(n<x)
    {
        return 0;
    }
//  ct(x,n-1);
//  ct(x,n-2);
    return ct(x,n-1)+ct(x,n-2);

}
int main()
{
    int k,ans;
    cin>>k;
    ans=ct(0,k);
    cout<<ans;
 } 

by lanretE @ 2022-06-19 10:39:32

要高精


by Yzj2010小号 @ 2022-06-19 10:54:34

加忆搜


by Technablode @ 2022-06-19 11:36:47

@阴语飞 python或者高精

头像好评(


by 阴语飞 @ 2022-06-22 16:12:31

谢谢hxd萌,过了^-^


by 阴语飞 @ 2022-06-22 16:14:43

@Technablode 更好康的


|