80分代码求调
查看原帖
80分代码求调
1772421
XYMAPLE楼主2025/8/5 16:23

#3和#11WA了,特殊案例#1通过,已经没次数下点了,求大佬帮蒟蒻调一下

#include<bits/stdc++.h>
using namespace std;
int main(){
    char tmp;
    stack<char> a;
    while(cin>>tmp){
        if(tmp=='-')cout<<'-';
        else{
            a.push(tmp);
        }
        
    }
    int i=1;
    while(!a.empty()){
        if(i==1 and a.top()=='0' and a.size()!=1){
            a.pop();
        }
        cout<<a.top();
        a.pop();
        i++;
    }
}
2025/8/5 16:23
加载中...