sunhewei @ 2024-10-01 08:35:27
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,sum=0;
cin>>n;
int num=n;
bool b=false;
while(sum<=n*n){
int a;
cin>>a;
sum+=a;
for(int i=1;i<=a;i++&&num--){
if(num==0){
cout<<endl;
num=n;
}
cout<<b;
}
b=!b;
}
return 0;
}
by SmileString @ 2024-10-01 08:55:49
@sunhewei
while(sum<=n*n)
改为
while(sum<n*n)
就过了,你这样会再运行一遍
by SmileString @ 2024-10-01 08:57:00
@sunhewei 也就是输完不会结束,还会运行一遍
by sunhewei @ 2024-10-01 09:01:09
@Dream66666 这次过了谢谢大神