求助大佬,看看哪错了 20分

P1307 [NOIP2011 普及组] 数字反转

liweiqing @ 2018-10-23 13:05:56

include<iostream>

using namespace std; int x; int main() { cin>>x; while(x>0) { cout<<x%10; x=x/10; } return 0; }


by x义x @ 2018-10-23 13:06:54

希望更丰富的展现?使用markdown


by x义x @ 2018-10-23 13:07:29

@liweiqing 负数考虑了吗?前导0考虑了吗?


by Tirpitz__ @ 2018-10-23 13:08:24

希望更丰富的展现?使用 ~~``` markdown


by Tirpitz__ @ 2018-10-23 13:08:35

gg


by liweiqing @ 2018-10-23 13:16:59

include<bits/stdc++.h>

using namespace std; int main() { int i; scanf("%d",&i); int as=i%10; int sd=i/10%10; int df=i/100; printf("%d",df+sd10+as100) return 0; }


by liweiqing @ 2018-10-23 13:17:21

这个也不行


by 已注销%Jm9VScx @ 2018-10-23 13:20:43

@liweiqing 是不是好看多了

#include<iostream>
using namespace std;
int x;
int main()
{ 
    cin>>x;
    while(x>0)
    { 
        cout<<x%10; 
        x=x/10; 
    } 
     return 0; 
}

by king_storm @ 2018-10-26 19:47:43

include<cstdio>

include<cstring>

using namespace std; char s[100]; int cnt; int main() { scanf("%s",s); int len1=strlen(s); cnt=len1; for(int i=len1-1;i>=0;i--) { if(s[i]=='0')cnt=i; else break; } if(s[0]=='-') printf("-"); for(int i=cnt-1;i>0;i--) { printf("%c",s[i]); } if(s[0]!='-') printf("%c",s[0]); return 0; }


by liweiqing @ 2018-10-27 10:07:54

问题已解决,谢谢各位大佬!


by 来自地狱的喵 @ 2019-03-28 17:30:39

gg


|