P1319
cpp#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int n,a,tot,sum;
int main()
{
int tot = 0;
scanf("%d",&n);
while(scanf("%d",&a) != EOF)//输入
{
if(tot % 2 == 0)//到输出0这个操作
{
for(int i = 1;i <= a;i++)
{
printf("0");
sum++;//记录一行的个数,不能超过n个
if(sum == n)//如果超过n个,就换行
{
printf("\n");
sum = 0;
}
}
tot++;//下一个操作
}
else//反之
{
for(int i = 1;i <= a;i++)
{
printf("1");
sum++;
if(sum == n)
{
printf("\n");
sum = 0;
}
}
tot++;
}
}
return 0;
}
本文作者:yowayimono
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!