讨论 / 程序
renyanyu345 2012-04-21 20:10:00
点我顶贴 收藏 删除
program rq151;

var

a,b:int64;

ans:qword;

s:string;

i,j:integer;

b1:boolean;

begin

read(a,b);

b1:=true;

if a=b then

begin

writeln(0);

halt;

end;

if (a>0) and (b<0) then ans:=a-b;

if (a<0) and (b>0) then

begin

ans:=-a+b;

b1:=false;

end;

if (a>0) and (b>0) then

if a<b then

begin

ans:=b-a;

b1:=false;

end

else ans:=a-b;

if (a<0) and (b<0) then

if abs(a)>abs(b) then

begin

ans:=-a+b;

b1:=false;

end

else ans:=-b+a;

if not b1 then write('-');

str(ans,s);

for i:=length(s) downto 2 do

begin

write(s[length(s)-i+1]);

if i mod 3=1 then write(',');

end;

writeln(s[length(s)]);

readln;

readln;

end.

查看更多回复
提交回复