lrqSB @ 2024-11-26 09:41:22
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int a,b[15];
bool c=1;
cin>>a;if(a<0){
cout<<"-";
b[0]=0;
a=abs(a);
}
for(int i=0;i<=9;i++){
b[i]=a%10;
a/=10;
}
for(int i=0;i<=9;i++){
if(b[i]==0){
c=false;
}if(b[i]!=0){
c=true;
}
if(c!=0){
cout<<b[i];
}
}
}
by xian_zhaoyuzhe @ 2025-01-10 17:57:30
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s,h,ans;cin>>s;int m=0;
if(s=="0")
{
cout<<0;
return 0;
}
if(s[0]=='-')
{
h="-";
m=1;
}
for(int i=s.size()-1;i>=m;i--)
{
ans+=s[i];
}
cout<<h;
int f=0;
for(int i=0;i<ans.size();i++)
{
if(ans[i]!='0' || f==1)
{
f=1;
cout<<ans[i];
}
}
}