l_Zilch_l @ 2024-10-15 20:03:55
#include<iostream>
#include<string>
using namespace std;
int main()
{
long n;
cin >> n;
string s = to_string(n);
int m = s.size();
if (n < 0)
cout << '-';
else if (n == 0)
cout << 0;
for (int i = m-1; i >=0; i--)
{
if (s[i] != '0' && s[i] != '-')
cout << s[i];
}
return 0;
}
by fangkai123 @ 2024-10-15 20:08:47
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int sum=0;
while(abs(n)>0){
sum*=10;
sum+=n%10;
n/=10;
}
cout<<sum;
return 0;
}