啊啊啊啊求助啊!!!!为什么只有20分呢???!!!

P1320 压缩技术(续集版)

Exile_Code @ 2023-07-13 08:11:16

#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>

int main() {

    string s1;
    cin >> s1;
    vector<string>area(s1.size());
    area[0] = s1;
    for (int i = 1; i < s1.size() ; i++) {
        cin >> area[i];
    }

    char b = area[0][0];
    int sum = 0;
    cout << s1.size() << " ";
    for (int i = 0; i < s1.size(); i++) {
        for (int j = 0; j < s1.size(); j++) {
            if (area[i][j] == b) {
                sum++;
            }
            else {
                cout << sum << " ";
                sum = 1;
            }
            b = area[i][j];
        }
    }
    cout << sum << " ";
    return 0;
}

by zhukaile @ 2023-07-13 08:53:20

你直接写个万能头就行了,头文件不用那么长!


by Exile_Code @ 2023-07-15 16:29:37

@zhukaile okok,但我这个代码哪里错了啊


by zhukaile @ 2023-07-16 09:56:31

我都不知道你做的是哪一题,怎么排错


|