0分?样例和下载的测试数据都正确啊?什么鬼

P1320 压缩技术(续集版)

cmd137 @ 2023-10-30 20:04:18

而且WA:提供的信息是把我输出的数n读为n+1了??? 以下是源码:```cpp

include <iostream>

using namespace std; int a[20005];

int main() { int n = 0; char t = '0'; char last = '0'; int p = 1; int N = 0; while (1) {

    t = getchar();

    if (t == '\n') {
        n = N;
        break;
    }

    if (t == last) {
        a[p]++;
    } else {
        a[++p]++;
        last = t;
    }
    N++;
}
for (int i = 1; i <= (n - 1) * (n + 1); i++) {
    t = getchar();

    if (t == '\n') {
        continue;
    }

    if (t == last) {
        a[p]++;
    } else {
        a[++p]++;
        last = t;
    }
}

cout << n << " ";
for (int i = 1; i <= p; i++) {
    cout << a[i] << " ";
}

}


by NumberTrart @ 2023-11-01 19:48:21

话说换行符是ASCII 10ASCII 13是哪个系统的换行符啊


上一页 |