xrz2895538112xrz @ 2017-06-22 21:51:02
#include<cstdio>
#include<iomanip>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<string>
using namespace std;
string in;
int pass=0;
int pai(string);
void works(string a)
{
for(int i=0;i<a.size();i++)
{
if(a[i]!='0')
break;
if(i==a.size()-1)
{
cout<<0;
return;
}
}
if(a[0]=='-')
{
cout<<'-';
for(int i=a.size()-1;i>=pai(a);i--)
{
if(!(a[i]=='0' && pass==0))
{
cout<<a[i];
pass++;
}
}
}
else
{
for(int i=a.size()-1;i>=pai(a);i--)
{
if(!(a[i]=='0' && pass==0))
cout<<a[i];
}
}
}
int pai(string b)
{
if(b[0]=='-')
{
for(int i=1;i<b.size();i++)
{
if(b[i]!='0')
return i;
}
}
else
{
for(int i=0;i<b.size();i++)
{
if(b[i]!='0')
return i;
}
}
}
int main()
{
cin>>in;
works(in);
return 0;
}
by SasukeUchiha @ 2017-07-04 15:36:35
萌新:你可以试一下2040,然后你会出42