哎呀呀呀k @ 2022-07-23 09:37:37
论我本来想刷刷水题,结果被水题刷了这件事。。 50分,5个点WA求助, 代码如下:
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
int main() {
string s, tmp;
while (cin >> tmp) s += tmp;
cout << int(sqrt(s.size())) << ' ';
if (s[0] == '1') cout << 0 << ' ';
char ch = s[0], ind = 0;
for (int i = 0; i < s.size(); i++) {
// cout << s[i] << endl;
if (ch != s[i]) {
cout << i - ind << ' ';
ch = s[i];
ind = i;
}
}
if (ind != s.size()) cout << s.size() - ind;
return 0;
}
by Juruoviet @ 2022-07-23 09:45:03
你这样例好像都过不去啊
by Firstly @ 2022-07-23 10:18:43
@哎呀呀呀k 你的
by 哎呀呀呀k @ 2022-07-23 10:24:51
。。。az原来是把ind定义成char类型了
by 哎呀呀呀k @ 2022-07-23 10:25:01
那没事了
by 哎呀呀呀k @ 2022-07-23 10:25:08
谢谢