Why TLE??? 50分求调,xuan guan
查看原帖
Why TLE??? 50分求调,xuan guan
1219707
CB_X2_Jun楼主2024/8/13 22:08

#6∼#10\#6 \thicksim \#10 都 TLE\tt \color{005577} TLE 了。

#include <iostream>
#include <cstring>
using namespace std;
char a[1000001],b[1000001],c='2';
int x=0;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> a;
    for(int i=0; i<strlen(a);i++)
    {
        if(a[i]!=c)
        {
            b[x]=a[i];
            c=a[i];
            x++;
        }
    }
    if(b[strlen(b)-1]=='0')cout << strlen(b);
    else cout << strlen(b)-1;
    return 0;
}

样例没问题,#1∼#5\#1\thicksim\#5 也都 AC\tt \color{00AA00} AC 了。

2024/8/13 22:08
加载中...