题目链接:https://www.luogu.org/problem/P1307
代码
#include <bits/stdc++.h>
using namespace std;
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
long long n,a,b=0;
cin>>n;
while(n%10==0){ //判断n后几位有零的情况;
n = n/10;
//cout<<n<<endl;
}
while(n!=0){
a = n%10;
b = b*10+a; //把除去尾数为零的n从后往前存入b中;
n = n/10;
//cout<<a<<""<<b<<" "<<n<<" ";
}
cout<<b<<endl;
return 0;
}
原文:https://www.cnblogs.com/zz9100/p/11252984.html