测试点六输出结果相同额,但wa了,有点懵。。

P1320 压缩技术(续集版)

mkd123 @ 2024-09-07 22:48:01


#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main(){
    vector<int> a;
    string x;
    cin >> x;
    for(int i=0;i<x.length();++i) {
        a.push_back(x[i] - '0');
    }
    char k;
    for(int i=0;i<(pow(x.length(),2)-x.length());++i){
        cin >> k;
        a.push_back(k-'0');
    }
//    for(int i=0;i<a.size();++i){
//        cout << a[i] << " ";
//    }
    int lingyi=0;
    vector<int> b;
    int y=0;
    cout << x.length() << " ";
    for(int i=0;i<=a.size();++i){
        if(a[i]==lingyi){
            ++y;
        }else{
            b.push_back(y);
            y=1;
            lingyi=(lingyi==0)?1:0;
        }
    }
    for(int i:b){
        cout << i << " ";
    }
    return 0;
}
![](https://cdn.luogu.com.cn/upload/image_hosting/oq6dxi0d.png)
![](![](https://cdn.luogu.com.cn/upload/image_hosting/35vuk4x5.png))
![](![](https://cdn.luogu.com.cn/upload/image_hosting/9ot5sxqe.png))
![](![](https://cdn.luogu.com.cn/upload/image_hosting/5yt6u5bg.png))

by mkd123 @ 2024-09-07 22:55:40

啊呀完了,搞错了,图片没传出来,输入是 00000 00000 00000 00000 00000 输出是5 25


by mkd123 @ 2024-09-07 23:00:20

() ()


by shelbyloveshiking @ 2024-11-19 19:56:48

洛谷的回车键是\r\n,跟一般的不一样,会导致输入出错。可以往后面几页讨论看看,都有人说过这个问题


|