yszkddzyh @ 2022-12-11 19:35:41
它总是说我的答案太短,麻烦各位看看
#include <iostream>
#include <cmath>
using namespace std;
int i,k,s,a[40003];
char c;
int main(){
while(cin>>c) a[k++]=c-48;
cout<<sqrt(k)<<' ';
while(i<=k){
while(i<=k){
if(a[i]==1){
cout<<s<<' ';
s=0;
break;
}
i++;
s++;
}
while(i<=k){
if(a[i]==0){
cout<<s<<' ';
s=0;
break;
}
i++;
s++;
}
}
return 0;
}
#2#7#9#10WA
by Kevin_Mamba @ 2022-12-11 20:44:23
@yszkddzyh 您就是那位匿名用户?
by ysxkrs @ 2022-12-11 20:44:26
你只需要在
by ysxkrs @ 2022-12-11 20:47:01
@yszkddzyh
#include <iostream>
#include <cmath>
using namespace std;
int i,k,s,a[40003];
char c;
int main(){
while(cin>>c) a[k++]=c-48;
cout<<sqrt(k)<<' ';
while(i<=k){
while(i<=k){
if(a[i]==1){
cout<<s<<' ';
s=0;
break;
}
i++;
s++;
}
while(i<=k){
if(a[i]==0){
cout<<s<<' ';
s=0;
break;
}
i++;
s++;
}
}
if(a[k-1]==0)cout<<s-1;//加上这个
return 0;
}
by yszkddzyh @ 2022-12-11 20:48:22
@xhlmrdr 本人已悟,谢谢
by yszkddzyh @ 2022-12-11 20:49:11
@2124Kobe 昨天开了完隐..