过了但有小疑问

P1320 压缩技术(续集版)

CHYhuanghan @ 2024-09-06 22:02:45

#include<iostream>
using namespace std;
#include<string>
#include<cmath>
#include<climits>
char a, b = '0';
int ans[40001];
int main()
{
    int k=0;
    int count = 0;
    while (cin >> a)
    {
        count++;
        if (a == b) ans[k]++;
        else ans[++k]++, b = a;
    }
    cout << sqrt(count) << " ";
    for (int i = 0; i <= k; i++)
    {
        cout << ans[i] << " ";
    }

    return 0;
}

在vs里面输入输不尽,但在luogu却是ac


by meifan666 @ 2024-09-06 22:06:48

@CHYhuanghan 测评机会加ctrl+z


|