如果i==j&&j-1>=0时候,f[i][j]=f[i][j-1];

如果j==0时候,f[i][j]=1;

其他 f[i][j]=f[i-1][j]+f[i][j-1];

#include <stdio.h>
int main(){
__int64 gird[][];
int i,j;
for(i=;i<=;++i)
gird[i][]=;
for(i=;i<=;++i){
for(j=;j<=i;++j){
if(j==i){
gird[i][j]=gird[i][j-];
continue;
}
gird[i][j]=gird[i-][j]+gird[i][j-];
}
}
int n;
int cnt=;
while(~scanf("%d",&n)){
if(n==-) break;
printf("%d %d %I64d\n",cnt++,n,gird[n][n]*);
}
return ;
}
05-11 09:31