0删掉要注意

P1307 [NOIP2011 普及组] 数字反转

康娜卡姆依 @ 2017-02-21 19:08:59

var s,t:string; n,i:longint;
begin
  read(n);
  if n>=0 then str(n,s) else str(-n,s);
  for i:=1 to length(s) do t:=s[i]+t;
  while t[1]='0' do delete(t,1,1);
  if n>=0 then write(t) else write('-',t);
end.

by Owen_szr @ 2017-03-20 21:11:27

厉害啊


|