1 条题解

  • 2

    #include<bits/stdc++.h>
    using namespace std;
    int ways(int x);
    int main()
    {
    int x;
    cin>>x;
    cout<<ways(x)<<endl;
    return 0;
    }

    int ways(int x)
    {
    if(x==1)
    return 1;
    else
    {
    if(x==2)
    return 2;
    else
    {
    if(x==3)
    return 4;
    else
    return ways(x-1)+ways(x-2)+ways(x-3);
    }
    }
    }

  • 1

信息

ID
1624
难度
3
分类
(无)
标签
递交数
23
已通过
17
通过率
74%
被复制
4
上传者