萌新求助,本地全过,oj全wa
查看原帖
萌新求助,本地全过,oj全wa
634950
Wwx_1412839289楼主2021/12/22 21:03
#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;
}
2021/12/22 21:03
加载中...