怎么爆零了啊啊啊,来个大佬帮忙看看 555.

P1320 压缩技术(续集版)

名字好难取144 @ 2023-09-07 17:11:44

记录放在这里

#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const int N=5e5+10;
int r,c,n,m,num,cnt;
int pos,flag,sum;

int a[300][300];

int main()
{

#ifndef ONLINE_JUDGE
    freopen("q.in","r",stdin);
    freopen("q.out","w",stdout);
#endif
    while(1) {
        char ch=getchar();
        //cout<<ch<<" ";
        if(ch=='\n'||ch==' ') break;
        a[1][++c]=ch-'0';
        //cout<<c<<" "<<a[1][c]<<"\n";

    }
    cout<<c<<" ";
    r=2;
    int c_=0;
    while(r<=c) {
        char ch=getchar();
        if(ch=='\n'||ch==' ') {
            r++;c_=0;
            continue;
        }
        a[r][++c_]=ch-'0';
    }
    for(int i=1;i<=r;++i) {
        for(int j=1;j<=c;++j) {
            num=a[i][j]; 
            if(num==0) {
                if(flag==0) {
                    sum++;
                }
                else {
                    flag=0;
                    cout<<sum<<" ";
                    sum=1;
                }
            }
            else {
                if(flag==1) {
                    sum++;
                }
                else {
                    flag=1;
                    cout<<sum<<" ";
                    sum=1;
                }
            }
        }
    }
    return 0;   
} 

rt,爆零,RE了#1、#3、#4、#5、#6,其它全是 WA,

下载了 #1 数据点,本地运行能过


by a_sad_soul @ 2023-09-07 20:27:14

我先%为敬


|