题解 | #放苹果#

放苹果

https://www.nowcoder.com/practice/bfd8234bb5e84be0b493656e390bdebf

#include <stdio.h>

int sort=0;
int patch( int anum,int pnum)
{
    if(anum==0||anum==1||pnum==1)
    {
        return 1;
    }else if(anum<pnum)
    {
        return patch(anum,anum);
    }else{
        return patch(anum,pnum-1)+patch(anum-pnum,pnum);
    }
}
int main() {
    int anum,pnum;
    scanf("%d%d",&anum,&pnum);
    sort=patch(anum,pnum);
    printf("%d",sort);
    return 0;
}

全部评论
看到题一脸懵,全靠扣楼里大神们的代码,呜呜呜
点赞 回复 分享
发布于 2023-11-19 16:36 广东

相关推荐

北漂的牛马人:211佬,包进的,可能是系统问题
点赞 评论 收藏
分享
fRank1e:吓得我不敢去外包了,但是目前也只有外包这一个实习,我还要继续去吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务