苣佬们,救救蒟蒻吧

P1320 压缩技术(续集版)

Soul_direction @ 2022-10-10 19:30:16

QAQ,过不去


#include<iostream>
#include <cstring>
using namespace std;
int main(){
    int i,n=0,m=0,v,ans=0,z,a[40001];
    char r;
    v=0;
    while((r=cin.get())!='\n'){
        n++;
        m++;
        i=r-48;
        a[m]=i;
    }
    int y;
    y=n-1;
    for(int e=1;e<=y;e++){
        while((r=cin.get())!='\n'){
        m++;
        i=r-48;
        a[m]=i;
    }
    }
    cout<<n<<' ';
    v=0;
    n=n*n;
    for(int h=1;h<=n;h++){
            if(a[h]==v){
            ans++;
            }
            else{
                cout<<ans<<' ';
                ans=0;
                v=1-v;
                ans++;
            }
    }
    cout<<ans;
    return 0;
}

by Composite_Function @ 2022-10-10 19:34:04

建议用 getline()


by Soul_direction @ 2022-10-10 19:35:12

栓Q


by Soul_direction @ 2022-10-10 19:37:46

能不能进我的团哈?沾沾苣佬的福气。www.luogu.com.cn/team/47899


|