linzihang @ 2024-05-26 19:27:09
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int b[201],sum=0,i=1;
while(sum!=n*n){
cin>>b[i];
sum+=b[i];
i++;
}
int k=0;
for(int j=1;j<=i;j++){
if(j%2==1){
while(b[j]!=0){
b[j]--;
cout<<0;
k++;
if(k==n){
cout<<endl;
k=0;
}
}
}else{
while(b[j]!=0){
b[j]--;
cout<<1;
k++;
if(k==n){
cout<<endl;
k=0;
}
}
}
}
return 0;
}
到底哪里有问题呀!!! 感谢各位大佬帮助我这个蒟蒻解决问题! 跪谢!!!
by 123huchenghao @ 2024-06-30 16:51:36
#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<ctime>
#include<vector>
#include<bitset>
#include<memory>
#include<utility>
#include<cstdio>
#include<sstream>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int n,a,t,m;
int main(){
cin>>n;
while(cin>>a){
if(a){
for(int i=1;i<=a;i++){
if(t==n){
cout<<endl;
t=0;
}
cout<<m;
t++;
}
}
m=(m==1?0:1);
}
return 0;
}
by Deitxau112485 @ 2024-07-11 11:06:51
@123huchenghao 你可以用万能头文件名<bits/stdc++.h>
by Deitxau112485 @ 2024-07-11 11:10:07
@123huchenghao 会简单很多