P1320の题解

P1320 压缩技术(续集版)

handsome6667633 @ 2022-07-11 17:52:05

#include<cstring>
#include<cmath>
#include<iostream>
#include<cstdio>
using namespace std;
int ans[99999];
int main(){
    string str;
    int n;int f=1;
    cin>>str;
    n=str.size();
    for(int i=2;i<=n;i++){
        string a;
        cin>>a;
        str+=a;
    }
    cout<<n<<" ";
    int num=0,t=1;
    for(int i=1;i<=n*n;i++){
        if(str[0]!='0'&&f==1)ans[++num]=0,f=0;
        if(str[i]==str[i-1]){
            t++;
        }
        else{
                ans[++num]=t;
                t=1;
        }
    }
    for(int i=1;i<=num;i++){
        cout<<ans[i]<<" ";
    }
    return 0;
}

我也不知道为啥能过 哪位大佬分析一下QWQ


by NastiY_iN_saNitY @ 2022-07-11 17:53:20


by Murder1t @ 2022-07-11 17:53:28

标题取的不行,容易被误解成讨论区题解()


by a1co0av5ce5az1cz0ap_ @ 2022-07-11 17:56:10

我差点以为tlqtj了


by 7708__qwq @ 2022-07-11 17:58:56

btd 草


by spark_minous @ 2022-07-11 18:05:59

差点以为是tlqtj,给jbl


by shengxuanyi @ 2022-08-12 16:23:31


|