全WA求助,下的数据过了
查看原帖
全WA求助,下的数据过了
300098
cmaths楼主2022/7/24 21:09
#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

2022/7/24 21:09
加载中...