Subtask #1 过不了为什么?
查看原帖
Subtask #1 过不了为什么?
832472
yishanyi楼主2023/8/11 10:29

Subtask #1 过不了为什么?

#include<bits/stdc++.h>

using namespace std;

int main() {
    string s;
    cin >> s;
    if (s[0] == '-') {
        cout << '-';
        s.erase(0, 1);
    }
    reverse(s.begin(), s.end());
    while (s[0] == '0') {
        s.erase(0, 1);
    }
    cout << s;
    return 0;
}

ps:我把去前导0的while去了#1点就能过

2023/8/11 10:29
加载中...