Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么用递推不对呀~~Runtime Error

Posted by liche717 at 2015-04-08 21:34:30 on Problem 1942
#include <iostream>

using namespace std;
long long f(long long n,long long m)
{
    if(n==0||m==0)
        return 1;
    if(n!=0&&m!=0) return f(n-1,m)+f(n,m-1);
}
int main()
{
    long long n,m;
    while(cin>>n>>m)
    {
        if(n==0&&m==0)
            break;
        else cout<<f(n,m)<<endl;
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator