为什么sqrt用不了??????
查看原帖
为什么sqrt用不了??????
529247
BLX32M_10楼主2022/2/26 21:09

RT,nn 的结果是 00。。。

#include <stdio.h>
#include <cmath>
#include <iostream>
int res[100005], sz;
int main()
{
	char x, tf = '0';
	int n = 0;
	while (std::cin >> x)
	{
		n++;
		if (x != tf)
			sz++, res[sz]++, tf = x;
		else
			res[sz]++;
	}
	printf("%d", std::sqrt(n));
	for (int i = 0; i <= sz; i++)
		printf(" %d", res[i]);
}
2022/2/26 21:09
加载中...