哪里错了

P1307 [NOIP2011 普及组] 数字反转

imbecile @ 2020-05-17 18:37:50

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    bool y=false;
    cin>>s;
    int n;
    n=s.size();
    if(s[0]=='-') cout<<"-";
    for(int i=n-1;i>=0;i--)
    {
        if(s[i]!='-'&&s[i]!='0') cout<<s[i]-48;
    }
}

by ChthollyMeow @ 2020-05-17 18:40:19

@zengxiangtuo 为什么要减48?


by ChthollyMeow @ 2020-05-17 18:40:47

@zengxiangtuo 第二,会多输出一个负号


by imbecile @ 2020-05-17 18:45:04

@_珂朵莉 减和不减不是一样的吗?


by imbecile @ 2020-05-17 18:51:27

@SIXIANG 什么意思?


by SIXIANG32 @ 2020-05-17 18:51:59

lz在装蒻!lz明明是AKIOI的神犇!lz在fAKe!像lz一样AKIOI的神仙怎么会连题目都不看!lzfAKe!!!!!!!


by imbecile @ 2020-05-17 18:52:29

对呀


by imbecile @ 2020-05-17 18:52:51

我不是有判断吗


by imbecile @ 2020-05-17 18:53:31

样例也没错呀


by SIXIANG32 @ 2020-05-17 18:53:59

@zengxiangtuo 不对,是中间的0


by imbecile @ 2020-05-17 18:54:07

输入800我的输出是8


| 下一页