C++错啦
查看原帖
C++错啦
631811
peter0710楼主2022/4/28 21:03

样例过了,下载完正确答案看了一下,是对的,这是程序:

#include<bits/stdc++.h>
using namespace std; 
int f[105][105]={},no;
int main()
{
	int a;
	cin >>a;
	f[0][0]=1;
	for(int i=0;i<a;i++){
		for(int j=0;j<a;j++){
			f[i][j]+=f[i-1][j-1]+f[i-1][j];
			if(f[i][j]==0){
				no=0;
			}
			else{
				cout<<f[i][j]<<" ";
			}
		}
		cout<<endl;
	}
	return 0;
}
2022/4/28 21:03
加载中...