20分求助(P1320 压缩技术(续集版))
查看原帖
20分求助(P1320 压缩技术(续集版))
625711
lanmengfei楼主2023/4/5 13:08

贴代码:

#include<bits/stdc++.h>
using namespace std;
char c[200*200+5];
int n=0,x=1;
int main(){
	while (cin>>c[n++]);--n;
	cout<<sqrt(n)<<" ";
	bool ok=0;
	for (int i=0;i<n;i++){
		if (c[i]==c[i+1]){
			++x;
		}
		else{
			cout<<x<<" ";
			x=1;
		}
	}
	return 0;
}

P1320 压缩技术 样例通过,自己出的数据也是对的,为什么只有20?QWQ

2023/4/5 13:08
加载中...