大佬们,帮我看看这代码有什么问题啊

P1320 压缩技术(续集版)

lucky_to_future @ 2024-03-06 15:45:21

include<iostream>

include<cmath>

include<algorithm>

include<cstring>

include<vector>

using namespace std; int main(){ string s1;string s2; cin>>s1; int len =s1.size(); s2=s1;

for(int i=1;i<len;i++){
    string ss;
    cin>>ss;
    s2+=ss;
}
    cout<<len<<" ";
    int k=1;
for(int i=0;i<len*len-1;i++){
    if(s2[i]==s2[i+1]) k++;
    else{cout<<k<<" ";k=1;}
}cout<<k;

}


by Disjoint_cat @ 2024-03-06 15:58:37

第一个数表示连续有几个 \texttt 0

也就是说如果左上角是 \texttt 1 你就要先输出一个 0 再输出连续的 \texttt 1 的个数。

@lucky_to_future


|