深紫渲蓝 @ 2016-05-06 17:34:32
#include <iostream>
#define MAXN 100001
using namespace std;
int main()
{
int a[MAXN]; long x,y=0,i=1; long n;
cin>>n;
if(n<0)
{ n=-n;
cout<<"-";}
while(n>0)
{
a[i]=n%10;
n/=10;
y++;i++;
}
for(int i=1;i<=y;i++)
{
while(a[i]==0) continue;
x=i;break;
}
for(x;x<=y;x++) cout<<a[x];
return 0;
}
by Ackoter @ 2016-05-07 09:40:07
我是pas的,不过你的好像很复杂,pas正解是很简单的,c++应该也是
by Deny_小田 @ 2016-05-07 13:48:11
嘿嘿嘿,我正好是大犇。你再想想,真的很简单==
by 自动Wrong机 @ 2016-07-10 14:55:12
我是用FREE PASCAL解的,测试都没有,直接过
var a,i,j:longint;
b:boolean;
s,s2:string;
begin
readln(a);
b:=false;
s2:='';
if a=0 then begin writeln(0);halt;end;
if a<0 then begin b:=true;a:=abs(a);end;
str(a,s);for i:=length(s) downto 1 do
s2:=s2+s[i];val(s2,i);
if b then write('-');
write(i);end.
by 自动Wrong机 @ 2016-07-10 14:55:58
望采纳