题解 | #走方格的方案数#

走方格的方案数

http://www.nowcoder.com/practice/e2a22f0305eb4f2f9846e7d644dba09b

#include <iostream>
using namespace std;

int GetNum(int raw, int col)
{
    if(raw == 1 || col == 1)
    {
        return raw+col;
    }
    else
    {
        return GetNum(raw-1,  col) + GetNum(raw, col-1);
    }
}

int main()
{
    int raw,col;

    while(cin>>raw>>col)
    {
        cout<<GetNum(raw, col)<<endl;
    }

    return 0;
}
全部评论

相关推荐

Gaynes:查看图片
点赞 评论 收藏
分享
点赞 评论 收藏
分享
但听说转正率很低,我现在有在实习了,好纠结要不要去
熬夜脱发码农:转正率低归低,但是实习的经历你可以拿着,又不是说秋招不准备了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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