首页 > 代码库 > 足球赛售票 1

足球赛售票 1

#include <iostream>using namespace std;#define MAX 200int dp[MAX][MAX];int f(int M,int N){    if(M<N)    return dp[0][N]=0;  if(N==0)  return dp[M][0]=1;   else if(N<=M)              return dp[M][N]=f(M-1,N) +  f(M,N-1);}int main(){    int m,n;    while (cin>>m>>n)    {        f(m,n);        cout<<dp[m][n]<<endl;    }    return 0;}

 

 

 

#include <iostream>using namespace std;#define MAX 200int dp[MAX][MAX];int f(int a,int b){   if(a<b)    return dp[0][b]=0;  if(b==0)  return dp[a][0]=1;   else if(b<=a)              return dp[a][b]=f(a-1,b) +  f(a,b-1);}int main(){    int m,n;    while (cin>>m>>n)    {        f(m,n);        cout<<dp[m][n]<<endl;    }    return 0;}

 

 

#include <iostream>using namespace std;#define MAX 200int dp[MAX][MAX];int f(int x,int y){   if(x<y)    return dp[0][y]=0;  if(y==0)  return dp[x][0]=1;   else if(y<=x)              return dp[x][y]=f(x-1,y) +  f(x,y-1);}int main(){    int m,n;    while (cin>>m>>n)    {        f(m,n);        cout<<dp[m][n]<<endl;    }    return 0;}