qq1992699715 @ 2022-01-28 13:51:58
#include <cstdio>
#include <cstring>
#include <cmath>
int main(){
int st=1,st2=1,ss=99,cnts[200],i=0,s=0,t=0,cnt=0;
char c[2];
memset(cnts,-1,sizeof(cnts));
while(1){
c[1]=getchar();
if (s>=ss*ss){cnts[i++] = cnt; break;}
if (st) {c[0]='0';st=0;}
if(c[1] == '\n'){
if(st2){ss=s;st2=0;}
continue;
}
if(c[1] == c[0]) cnt++;
else {
cnts[i++] = cnt;
cnt=1;
c[0] = c[1];
}
s++;
}
printf("%d ",ss);
while(cnts[t] != -1){
printf("%d ",cnts[t]);
t++;
}
return 0;
}
by fyder_anran @ 2022-01-28 13:54:11
你C++头文件呢
by HarunluoON @ 2022-01-28 14:25:16
using namespace std;