讨论 / 用高精写的,恶心死了……
fdiqecvhihrqt 2008-07-31 03:25:00
点我顶贴 收藏 删除
用高精写的,恶心死了……89line
#1 wish@2008-07-30 20:31:00
回复 删除
89行不算恶心

我没用高精度 70 行

这才叫恶心

#2 gaoxin@2008-07-30 20:36:00
回复 删除
var

a,b:int64;

x:qword;

begin

if a<b then

begin

write(-);

x:=b-a;

end

else x:=a-b;

20行

#3 lychees@2008-07-30 21:44:00
回复 删除
50多行 囧~
#4 vinence@2008-07-31 03:16:00
回复 删除
的确很恶心,

我部分用高精.

60行...

ps,

gaoxin的程序貌似不行吧?

如果a-b,a=+max,b=-max,怎么办?

#5 wish@2008-07-31 03:25:00
回复 删除
program p151(input, output);

var

 a, b, c: qword;

 aa, bb: int64;

 p, S: ansistring;

 flag: boolean;

begin

 readln(aa, bb);

 a := abs(aa);

 b := abs(bb);

 if aa < 0 then

  if bb > 0 then

   begin

    c := a + b;

    flag := true

   end

  else

   begin

    if b > a then

     begin

      flag := false;

      c := b - a

     end

    else

     begin

      flag := true;

      c := a - b

     end

   end

 else

  if bb < 0 then

   begin

    c := a + b;

    flag := false

   end

  else

   begin

    if a > b then

     begin

      flag := false;

      c := a - b

     end

    else

     begin

      flag := true;

      c := b - a

     end

   end;

 S := ;

 while c > 0 do

  begin

   str(c mod 1000, p);

   c := c div 1000;

   if c > 0 then

    if length(p) = 1 then

     p := 00 + p

    else if length(p) = 2 then

     p := 0 + p;

   if S = then

    S := p

   else

    S := p + , + S

  end;

 if S = then

  S := 0

 else if flag then

  S := - + S;

 writeln(S)

end.

查看更多回复
提交回复