有大佬可以帮忙吗?不知道哪里错了.
查看原帖
有大佬可以帮忙吗?不知道哪里错了.
760859
Let_Fly楼主2022/8/13 18:29
#include <iostream>

using namespace std; 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	int n,b;
	cin>>n;
	int a[n*n];
	int sam=0,v=1;
	while(sam<n*n){
		cin>>b;
		sam+=b;
		if(v%2==0){
			for(int i=0;i<=b;i++){
				a[i]=1;
			}
		}
		else{
			for(int i=0;i<=b;i++){
				a[i]=0;
			}
		}
	}
	for(int j=0;j<=n;j++){
		for(int i=0;i<=n;i++){
			cout<<a[i+j*n];
		}
		cout<<endl;
	}
	return 0;
}
2022/8/13 18:29
加载中...