奇妙の写法

P1320 压缩技术(续集版)

wangmang @ 2022-11-15 17:33:34

#include<bits/stdc++.h>
using namespace std;
int main()
{   
    int n,l;
    char A[300],b;
    cin>>A;
    l=0;
    n=strlen(A);
    int c[n*n+10]={},m=1;
    for(int i=1;i<=n;i++)
    {
        for(int o=1;o<=n;o++)
        {
            if(i==1)
            {
                b=A[o-1];
            }
            else
            {
                cin>>b;
            }
            if(b=='1'&&l==0||b=='0'&&l==1)
            {
                m++;
                l=(l+1)%2;
            }
            c[m]++;
        }
    } 
    cout<<n;
    for(int i=1;i<=m;i++)
    {
        cout<<" "<<c[i];
    }
    return 0;
}

by DEMAC @ 2022-11-15 17:37:46

挺正常的啊(


|