样例能过 提交全是wa 求助一下大佬
查看原帖
样例能过 提交全是wa 求助一下大佬
609183
Werw楼主2022/4/18 17:13
#include<stdio.h>
#include<string.h>
char num[50000];
char tem[220];
int count[50000];
int main(){
int length,cou=1,first=0;
scanf("%s",&tem);
length=strlen(tem);
strcat(num,tem);
count[0]=length;
while(scanf("%s",&tem)!=EOF){
	strcat(num,tem);
}//读入 
for(int i=0;i<length*length;i++){
	if(cou%2!=0){ 
		count[cou]++;
		if(num[i+1]=='1')cou++;
	}
	else{
		count[cou]++;
		if(num[i+1]=='0')cou++;
	}
	} 
for(int i=0;i<50000;i++){
	if(count[i]){
		if(first)printf(" ");
                else first=1;
		printf("%d",count[i]);
		if(count[i+1]==0)break;
	}
}
return 0;
}
2022/4/18 17:13
加载中...