99本蒟蒻

P1307 [NOIP2011 普及组] 数字反转

SUPERBOY114 @ 2023-11-23 16:39:54

#include<bits/stdc++.h>
using namespace std;
int main(){
    int b,d,a,c,e;
    cin>>a;
    while(a){
        c=c*10+a%10;
        a/=10;
    }
    cout<<c;
    return 0;
} 

by sbno333 @ 2023-11-23 16:42:46

#include<bits/stdc++.h>
using namespace std;
int main(){
    int b,d,a,c,e;
    c=0;//初始化qwq
    cin>>a;
    while(a){
        c=c*10+a%10;
        a/=10;
    }
    cout<<c;
    return 0;
} 

by xingjielong @ 2023-11-25 18:44:47

啊? 就要这么点?


by xingjielong @ 2023-11-25 18:45:45

啊?还通过了?


by xingjielong @ 2023-11-25 18:50:54

幸好有缺点 1.范围较小 2.特殊情况前导0删不掉


|