首页 > 代码库 > 足球赛售票2
足球赛售票2
#include <stdio.h>
#define MAX 200
int main( )
{
int n,i,j,a[MAX][MAX]={0};
scanf("%d",&n);
for ( i=0; i<=n; i++) a[i][0]=1;
for (i=1; i<=n; i++)
for (j=1;j<=i; j++)
a[i][j]=a[i-1][j]+a[i][j-1];
printf("%d\n",a[n][n]);
}
#include <stdio.h>
#define MAX 200
int main( )
{
int m,n,i,j,a[MAX][MAX]={0};
scanf("%d%d",&m,&n);
for ( i=1; i<m; i++)
a[i][0]=1;
for (i=1; i<=m; i++)
for (j=1;j<=n; j++)
a[i][j]=a[i-1][j]+a[i][j-1];
printf("%d\n",a[m][n]);
}
#include <stdio.h>
#define MAX 200
int main( )
{
int m,n,i,j,a[MAX][MAX];
scanf("%d%d",&m,&n);
for ( j=1; j<n; j++)
a[0][j]=0;
for ( i=1; i<m; i++)
a[i][0]=1;
for (i=1; i<=m; i++)
for (j=1;j<=n; j++)
a[i][j]=a[i-1][j]+a[i][j-1];
printf("%d\n",a[m][n]);
}