全部评论 7

  • 到底是谁从“最新回复”传送到这里来呢?好难猜啊(

    2025-12-06 来自 重庆

    1
  • 你这样只能处理110这样的情况,碰到190000就炸了,应该把反转后所有前导0都去掉

    2025-12-05 来自 上海

    1
  • 试了,可以,不过复杂:
    #include<bits/stdc++.h>
    using namespace std;
    string n;
    int main(){
    cin>>n;
    bool a=false;
    for(int i=n.size()-1;i>=0;i--){
    if(n[i]!='0'||a==true){
    cout<<n[i];
    a=true;
    }
    }
    return 0;
    }

    2025-12-22 来自 河南

    0
  • #include<bits/stdc++.h>
    using namespace std;
    int main(){
        string s;cin >> s;
        reverse(s.begin(),s.end());
        cout << stoi(s);
    }
    

    2025-12-06 来自 广东

    0
  • reverse + stoll 可能可以

    2025-12-06 来自 上海

    0
  • #include<bits/stdc++.h>
    using namespace std;
    #define int long long 
    signed main(){
        string n;
        cin>>n;
        reverse(n.begin(),n.end());
        int pos=0;
        while(pos<n.size()-1&&n[pos]=='0'){
            pos++;
        }
        cout<<n.substr(pos);
        
        return 0;
    }
    

    猎奇码风

    2025-12-05 来自 天津

    0
    • #include<bits/stdc++.h>
      using namespace std;
      #define int long long 
      signed main(){
          string n;
          cin>>n;
          while(n.back()=='0')n.pop_back();
          reverse(n.begin(),n.end());
          cout<<n;
          return 0;
      }
      

      嘶~更猎奇了

      2025-12-05 来自 天津

      0
    • 不适隔门你直接贴代码的?

      2025-12-06 来自 浙江

      0
    • 666我也是这码风,别骂了QAQ

      2025-12-06 来自 重庆

      0
  • 显然可以啊

    2025-12-05 来自 浙江

    0

热门讨论