mrHCT @ 2023-01-13 17:26:01
#include<iostream>
#include<cmath>
using namespace std;
int a[205][205];
int b[200005];
int main()
{
int n;
int ant=0;
int sum=0;
int falg=0;
int ad=0;
int i=0;
int j=0;
cin>>n;
for(int i=0;sum<n*n;i++)
{
cin>>b[i];
sum+=b[i];
ad++;
}
for(int k=0;k<ad;k++)
{
ant=b[k];
while(1)
{
a[i][j]=falg;
ant--;
if(j==n-1)
{
i++;j=0;
}
else
{
j++;
}
if(ant==0)break;
}
switch(falg)
{
case 0:falg=1;break;
case 1:falg=0;break;
}
}
for(int d=0;d<n;d++)
{
for(int f=0;f<n;f++)
{
cout<<a[d][f];
}
cout<<endl;
}
return 0;
}
by Wyz66 @ 2023-01-14 10:04:02
@mrHCT 大佬
你运行对了吗?
by mrHCT @ 2023-01-14 15:09:26
@Wyz66 样例过了啊(qaq)
by tabelog_AFO @ 2023-02-10 21:23:51
#include <bits/stdc++.h>
using namespace std;
int main() {
int a,n,t=0,i=0,b,s=0;
cin>>n;
while (s<n*n) {
cin>>a;
i++;
for (b=a;b>=1;b--) {
if (t==n) {
cout<<endl;
t=0;
}
if (i%2==1) cout<<0;
else cout<<1;
t++,s++;
}
}
cout<<endl;
return 0;
}
by Kevin_1229 @ 2023-03-19 15:18:45
jntm