标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 41563 Accepted Submission(s):
17414
#include<stdio.h> int main() { int n,m,j,i,l; int a[35][35]; while(scanf("%d",&n)!=EOF) { for(i=1;i<=n;i++) //给首尾赋值1 { a[i][1]=1; a[i][i]=1; } for(i=3;i<=n;i++) { for(j=2;j<i;j++) { a[i][j]=a[i-1][j]+a[i-1][j-1];//给出递推公式 } } for(i=1;i<=n;i++) { for(j=1;j<=i;j++) { if(j!=i) printf("%d ",a[i][j]); else printf("%d",a[i][j]); } printf("\n"); } printf("\n"); } return 0; }
标签:
原文地址:http://www.cnblogs.com/tonghao/p/4373682.html