萌新求助,本地全过,oj全wa

P1320 压缩技术(续集版)

Wwx_1412839289 @ 2021-12-22 21:03:48

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

int main( )
{
    vector<char> enter;
    char check = ' ';
    int count = 0;
    int record = 0;
    while(check != '\n')
    {
        check = getchar( );
        if(check != '\n')
        {
            enter.push_back(check);
            record ++;
        }
    }
    for(int i = 0;i < (record+1)*(record-1);i ++)
    {
        check = getchar( );
        if(check != '\n')
        {
            enter.push_back(check);
        }
    }
    cout << record << ' ';
    for(int i = 0;i < record*record;i ++)
    {
        if(i == 0)
        {
            if(enter[0] == '1')
            {
                cout << 0 << ' ';                
            }
            count ++;
        }
        else
        {
            if(enter[i] == enter[i-1])
            {
                count ++;
            }
            else
            {
                cout << count << ' ';
                count = 1;
            }
        }
    }
    cout << count << endl;

    system("pause");
    return 0;
}

by lovelyboydx @ 2021-12-27 19:49:52

同问


|