Contemptuous @ 2022-07-29 13:49:13
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
string s;
getline (cin,s);
int n=s.size();
for (int i=1; i<n; ++i) {
string a;
getline (cin,a);
s+=a;
}
cout << n << " ";
int i=0;
int sum=0;
if (s[0]=='1') {
cout << 0 << " ";
sum++;
i++;
} else {
sum++;
i++;
}
while (i<=n*n) {
if (s[i]==s[i-1]) {
sum++;
i++;
} else {
cout << sum << " ";
sum=1;
i++;
}
}
return 0;
}
请各位大佬帮个忙
by iiiiiyang @ 2022-07-29 13:54:37
不要 getline 啦,推荐放到在线IDE里头,估计是没有输出的
by iiiiiyang @ 2022-07-29 13:56:23
@hushouzhe getline全换成cin就过了
by Contemptuous @ 2022-07-29 13:59:16
@forqprever
过了,谢谢大佬