n_bluetea @ 2022-04-14 19:04:40
#include<stdio.h>
#include<string.h>
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#pragma warning(disable:4996)
int box[100000];
int main()
{
int n;
int length;
int sum = 0;
int S = 0;
scanf("%d", &n);
int i = 1;
while(1)
{
scanf("%d", &box[i]);
S += box[i];
i++;
if (S == n * n)
break;
}
length = sizeof(box);
for (int i = 1; i <= length; i++)
{
for (int j = 1; j <= box[i]; j++)
{
if (i % 2 == 1)
printf("0");
if (i % 2 == 0)
printf("1");
sum++;//当字符数达到n的时候换行
if (sum % n == 0)
printf("\n");
}
}
return 0;
}
by KAqwq @ 2022-04-14 19:15:05
看看数组是不是开小了
by n_bluetea @ 2022-04-14 19:22:55
@Kamisato_Ayato 好像不是,俺试着开大了,还是re qwq
by KAqwq @ 2022-04-14 19:25:15
@n_blutea RE=Runtime Error 你的代码在运行过程中中断了 可以找找你代码里的bug
by n_bluetea @ 2022-04-14 19:42:20
@Kamisato_Ayato 谢谢大佬提醒, 我找到问题了, 我计算数组位数的方法错了, 我也不知道我本地为什么能过qwq
改后代码``` length = i-1;
by KAqwq @ 2022-04-14 20:33:56
@n_blutea 可能是样例太水了 你这让我想起我去年考提高T1样例全过10pts