guorunduo @ 2023-08-23 20:47:34
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,a,b[40000];
cin>>n;
int s=0,s1=0,s2=0;
while(s<=n*n){
cin>>a;
s+=a;
s1++;
for(int j=1;j<=a;j++){
if(s2==n){
cout<<endl;
s2=0;
}
if(s1%2==1){
cout<<'0';
}
else cout<<'1';
s2++;
}
}
}```
by guorunduo @ 2023-08-23 20:48:29
我看了测试点一,没问题呀?
by Let_Fly @ 2023-08-23 20:49:46
多输出了一行0
by guorunduo @ 2023-08-23 20:53:27
??我这里没显示多0呀
by Let_Fly @ 2023-08-23 20:55:52
0001000
0001000
0001111
0001000
0001000
0001000
1111111
0000000
yours
by Let_Fly @ 2023-08-23 20:56:18
0001000
0001000
0001111
0001000
0001000
0001000
1111111
ac
by RainBow_doge @ 2023-08-23 20:57:48
第七行应该是s<n*n
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,a,b[40000];
cin>>n;
int s=0,s1=0,s2=0;
while(s<n*n){
cin>>a;
s+=a;
s1++;
for(int j=1;j<=a;j++){
if(s2==n){
cout<<endl;
s2=0;
}
if(s1%2==1){
cout<<'0';
}
else cout<<'1';
s2++;
}
}
}
by RainBow_doge @ 2023-08-23 20:58:07
@guorunduo
by Let_Fly @ 2023-08-23 20:58:21
@RainBow_doge 说的对
by guorunduo @ 2023-08-23 21:01:11
ac了,谢谢