户山香澄 @ 2016-09-21 16:29:49
用字符串做的。。。前导0也去了。。。负号也算了。。。可是为什么只有70分。。。
var s:string;
i:longint;
begin
readln(s);
if s[1]='-' then write('-');
for i:=length(s) downto 1 do if (s[i]<>'0') and (s[i]<>'-')
then write(s[i]);
if s='0' then write('0');
writeln;
end.
by chenfeiyang @ 2016-09-21 16:37:40
不知道
by pupuvovovovovo @ 2016-09-21 17:59:48
哪是去前导零啊,这把所有零都去了。手模一个数据:101。输出:11。
by 巴塞罗那竞技 @ 2016-09-24 13:52:54
var
t,s:string;
i:integer;
begin
readln(t);
if (t='0')or(t='-0') then
begin writeln('0'); halt; end;
if t[1]='-' then
begin
write('-');
delete(t,1,1);
end;
for i:=length(t) downto 1 do
if t[i]='0' then delete(t,i,1) else break;
for i:=1 to length(t) do
s:=s+t[length(t)-i+1];
writeln(s);
end.
by moxiangyu @ 2016-09-27 18:37:24
哪是去前导零啊,这把所有零都去了。手模一个数据:10100132。输出:23111。
var
s:string;
k,j,i:longint;
begin
readln(s);
k:=1;
if s[1]='-' then begin//判断负号,注意减少最后输出的循环下界
write('-');
inc(k);
end;
j:=length(s);
while s[j]='0' do dec(j);//判0,千万不要判一次only!!!
for i:=j downto k do write(s[i]);
end.
by 宋瑞aaaa @ 2016-10-29 22:23:10
var
bo:0..1;
s:ansistring;
i,m,p: integer;
begin
readln(s);
if s[1]='-' then begin bo:=1; write('-'); m:=m-1;end;
m:=length(s);
for i:=m downto 1 do
begin
if (s[i]<>'0') then break;
if (s[i]='0') then dec(m);
end;
p:=1;
if bo=1 then inc(p);
for i:=m downto p do
write(s[i]);
readln;
end.