我将这题的C函数转成PASCAL的,希望对PASCAL的同学有帮助。
1: function fpath(x,y,z:longint):longint;
var a : longint;
begin
2: a:=10*x*x;x:=a;
3: if x<y then begin
4: y:=a;
5: end;
6: if 100*x+20*y>z then begin
7: if x<y then begin
8: x:=x+10;
9: end else begin
10: y:=y-9;
11: end;
12: end else if 2*x*x-y>=z then begin
13: a:=a-10;
14: end else if x+z>100 then begin
15: a:=a+90;
16: end;
17: while a>0 do begin
18: if x<y then begin
19: x:=x+1;a:=a-1;
20: end else begin
21: y:=y-1;a:=a-1;
22: end;
23: end;
24: end;