文章
2
粉丝
0
获赞
1
访问
500
#include<stdio.h>
int S(int n ,int m){ //n是行 m是列
if(m==1 || m==n ) return 1;
else if(m>n) return 0;
else return S(n-1,m)+S(n-1,m-1);
}
int main(){
int n=0;
scanf("%d",&n);
int temp=0;
int curRow=1,i=0;
while(curRow<=n){
for(i=1;i<=curRow;i++){
temp=S(curRow,i); //curRow是行 i是列
printf("%d ",temp);
}
...
登录后发布评论
暂无评论,来抢沙发