样例能过 提交全是wa 求助一下大佬

P1320 压缩技术(续集版)

Werw @ 2022-04-18 17:13:18

#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;
}

|