我想到了一个神奇的办法
使用unsigned long long!!!
#include <iostream>
using namespace std;
typedef unsigned long long p;
p a, b;
char c;
p f( p n ) {
p x = 0;
for ( ; n; n /= 10 )
x = x * 10 + n % 10;
return x;
}
int main() {
cin >> a;
cout << f( a );
if ( cin.get( c ) ) {
if ( c == '%' )
cout << '%';
else {
cin >> b;
cout << c << f( b );
}
}
return 0;
}