slysly @ 2016-08-09 20:38:44
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<algorithm>
#include<functional>
using namespace std;
int main()
{
int n,g=0,j=0;
cin>>n;
int a[n*n],b[n*n];
for(int i=0;i>=0;i++)
{
int sum=0;
cin>>b[i];
sum+=b[i];
g++;
if(sum==n*n) break;
}
for(int i=0;i<g;i++)
{
for(int k=0;k<b[i];k++)
{
a[j]=b[i]%2;
j++;
}
}
for(int i=0;i<n*n;i++)
{
for(int k=0;k<n;k++)
cout<<a[i];
cout<<endl<<endl;
}
return 0;
}
by as2393125 @ 2017-10-02 21:32:47
我也是这个思路,结果全都Too many or too few lines.莫名其妙。
by as2393125 @ 2017-10-02 21:34:10
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=40000+5;
int a[maxn];
int main(){
int n,m=0,i,j,k=0;
int cnt=0;
cin>>n;
while(m<n*n){
cin>>a[++cnt];
m+=a[cnt];
}
for(i=1;i<=cnt;++i)
for(j=1;j<=a[i];++j){
cout<<!(i%2);
++k;
if(k%7==0&&k!=n*n)
putchar('\n');
}
return 0;
}