AC有点难 @ 2017-01-26 09:48:52
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
const int maxn=17;
int main(){
freopen("reverse.in","r",stdin);
freopen("reverse.out","w",stdout);
int n,k=1;
cin>>n;
int a[maxn];
while(n>1){
n/=10;
k++;
}
for(int i=1;i<=k;i++)
a[i]=0;
for(int i=1;i<=k;i++){
int x=pow(10,i);
a[i]=n%x;
n/=10;
}
for(int i=0;i<k;i++)
a[i]=a[k-i];
for(int i=0;i<k;i++)
cout<<a[i];
fclose(stdin);fclose(stdout);
}
by 命鱼—逗比酒 @ 2017-01-28 11:13:51
#include <iostream>
#include<cstdio>
#include<iomanip>
#include<cstring>
using namespace std;
int main()
{
int a,i=0;
cin>>a;
while(a!=0)
{
i=i*10+a%10;a/=10;
}
cout<<i;
return 0;
}