求助,猛猛报错

P1319 压缩技术

ArioKings @ 2024-03-16 22:01:43

1,3 AC 2,6,9,10 MLE 4,5,7,8 WE 求大佬指点

#include<iostream>
#include<string>

using namespace std;

int main() {
    string a;
    char a_1;
    bool b = false;
    int lmr;
    int lmr_1 = 0;
    cin >> lmr;
    int sum = lmr * lmr;
    int sum_1 = 0;
    for (int i = 0;; i++) {
        cin >> a_1;
        a += a_1;
        sum_1 += (int)a_1 - '0';
        if (sum_1 >= sum)
            break;
    }
    for (int i = 0; i < a.size(); i++) {
        int c = (int)a[i] - '0';
        while (c) {
            if (lmr_1 < lmr) {
                lmr_1++;
                cout << b;
            }
            else {
                cout << endl;
                cout << b;
                lmr_1 = 1;
            }
            c--;
        }
        b = !b;
    }
}

|