#5#6过不了
查看原帖
#5#6过不了
1643406
shenliyan楼主2025/1/22 21:55

很奇怪,一会儿#6RE,#7RE,一会儿#6RE,#7WA,一会儿#6WA,#7RE,一会儿#6WA,#7WA. #6WA,#7WA:https://www.luogu.com.cn/record/200038303 #6WA,#7RE:https://www.luogu.com.cn/record/200038429 #6RE,#7RE:https://www.luogu.com.cn/record/200038865 #6RE,#7WA:https://www.luogu.com.cn/record/200039100 都是同样的代码,数据下载了,本地输出没错,但洛谷错了。 ** code **

#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int t, a[205];
    char c;
	bool flag;
	cin>>c;
	int g = 1,s = 1;
	flag = c == '0' ? false : true;
	if(flag)a[++t] = 0;
	while(cin>>c){
		if(c != '0' && c != '1')continue;
		g++;
		if((c == '0' && flag)||(c == '1'&& !flag)){
			flag = c == '0' ? false : true;
			a[++t] = s;
			s = 0;
		}
		++s;
	}
	a[++t] = s;
	printf("%.0lf ", sqrt(g));
	for(int i = 1; i <= t; ++i)cout<<a[i]<<" ";
	return 0;
}
2025/1/22 21:55
加载中...