10pts求调QAQ

P1320 压缩技术(续集版)

XXY2022 @ 2024-07-08 15:13:23

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int x=25;
    string a;
    char mb_mb='0';
    char mb[50000]={0};
    int n;
    int t[50000]={0};
    int k=0;
    int i,a_l;
    for(i=0;i<x;i++)
    {
        cin>>a;
        a_l=a.length();
        x=a_l;
        for(int m=0;m<a_l;m++)
        {
            mb[m*(1+i)]=a[m];
            if(mb[i]==mb_mb)
            {
                t[k]++;
            }
            else
            {
                k++;
                mb_mb='1'-(mb_mb-'0');
            }
        }
    }
    cout<<a_l;
    for(int j=0;j<=k;j++)
    {
        cout<<' '<<t[j];
    }
    return 0;
 } 

by XXY2022 @ 2024-07-09 10:55:46

改了一下变20pts了

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    string a;
    char mb_mb='0';
    char mb[50000]={0};
    int n;
    int t[41000]={0};
    int k=0;
    int i=0,a_l;
    int while_t=0,while_i=0;
    while(1)
    {
        i++;
        while_i++;
        cin>>a;
        a_l=a.length();
        while_t=a_l;
        for(int m=0;m<a_l;m++)
        {
            mb[m*5+i]=a[m];
            if(mb[i]==mb_mb)
            {
                t[k]++;
            }
            else
            {
                k++;
                m--;
                mb_mb='1'-(mb_mb-'0');
            }
        }
        if(while_i==while_t)
        {
            break;
        }
    }
    cout<<a_l;
    for(int j=0;j<=k;j++)
    {
        cout<<' '<<t[j];
    }
    return 0;
 } 

|