joey007 @ 2022-11-11 17:22:19
源代码:
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
int square;
cin>>square;
int a[square * square + 10] = {0};
bool pc = true;
int times = 0;
for(int i =1;i<(square*square);i+=a[i]0){
cin>>a[i];
pc = !pc;
for(int j = 0;j<a[i];j++){
cout<<pc;
times++;
if(times == 7){
cout<<endl;
times = 0;
}
}
}
return 0;
}
by LiaoYF @ 2022-11-11 17:27:33
@joey007 没说七个换行,是n个换行
by LiaoYF @ 2022-11-11 17:28:00
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
int square;
cin>>square;
int a[square * square + 10] = {0};
bool pc = true;
int times = 0;
for(int i =1;i<(square*square);i+=a[i]){
cin>>a[i];
pc = !pc;
for(int j = 0;j<a[i];j++){
cout<<pc;
times++;
if(times == square){//here
cout<<endl;
times = 0;
}
}
}
return 0;
}
by joey007 @ 2022-11-11 18:50:44
栓Q
by joey007 @ 2022-11-11 18:51:02
thanks