englishpeople @ 2022-03-10 18:37:10
#include<iostream>
using namespace std;
int main(){
int a;
cin>>a;
bool b=false;
char c;
int sum=0;
while(1)
{
cin>>c;
if(c=='\n')
break;
for(int i=0;i<c;i++)
{
cout<<b;
sum++;
if (sum==a)
{
cout<<"\n";
sum=0;
}
}
b=!b;
}
}
by Jasper08 @ 2022-03-10 18:39:47
@englishpeople
#include <iostream>
using namespace std;
int main()
{
int n = 0;
cin >> n;
int num[40005] = {};
short sum = 0;
int i = 0;
while (sum != n * n)
{
cin >> num[i];
sum += num[i];
++i;
}
int count = 0, zo = 0;
for (int j = 0; j <= i; ++j)
{
for (int k = 0; k < num[j]; ++k)
{
++count;
if ((count - 1) % n == 0 && count - 1 != 0)
cout << endl;
cout << zo;
}
if (zo == 0)
zo = 1;
else
zo = 0;
}
return 0;
}