代码可以通过测试案例,最后得分20.代码奉上,请大佬提携指教

P1320 压缩技术(续集版)

```cpp #include<bits/stdc++.h> using namespace std; typedef long long ll; string s,k; ll n,a=1; int main(){ cin.tie(0),cout.tie(0),ios::sync_with_stdio(0); while(cin>>k){ s+=k; }s+='k'; n=k.size(); cout<<n<<" "; if(s[0]=='1'){ cout<<"0 "; } for(int i=1;i<s.size();i++){ if(s[i]==s[i-1]){ a++; }else{ cout<<a<<" "; a=1; } } return 0; } ```
by m1xax @ 2024-04-07 17:31:01


|