cmaths @ 2022-07-24 21:09:19
#include <cstdio>
#include <cmath>
char a[40005];
int main()
{
char tem;
int cnt = 0;
while(scanf("%c", &tem) == 1)
{
if(tem != '\n')
{
a[++cnt] = tem;
}
}
printf("%d ", (int)sqrt(cnt));
int cntt = 0, st = 0;
for(int i = 1; i <= cnt + 1; i++)
{
if(a[i] != st + '0' || i == cnt + 1)
{
printf("%d ", cntt);
st = 1 - st;
cntt = 0;
}
cntt++;
}
return 0;
}
1.in:
11111
00100
11111
00100
11111
1.out:
5 0 5 2 1 2 5 2 1 2 5
the code:
5 0 5 2 1 2 5 2 1 2 5
但是全WA,求助 orz
by detor @ 2022-07-24 22:15:47
结果不一样,可能是你的程序输出BUG了 洛谷在线IDE测评了,结果为: 5 0 5 3 1 2 6 3 1 2 6
by cmaths @ 2022-07-25 06:42:24
@detr 啊这 我在DevC++上测的结果和数据一样
by detor @ 2022-07-25 09:04:35
@xjr300098 那东西现在能信?BUG奇多. 比如说内存溢出导致的bug莫名其妙.
by cmaths @ 2022-07-25 09:13:14
@detr 已经解决了,输入那一行%c后面加个空格就好了 qwq