|
|
back to boardWhy do I get WA???? type fff=record h:longint; x:extended; end; var top,kk:extended; n:longint; a,b,c:fff; procedure zl; var i,j:integer; oo:fff; begin readln(a.h,a.x,c.h,c.x,n); if a.h>c.h then begin oo:=a; a:=c; c:=oo; end; b.h:=a.h+1; if a.h<>c.h-1 then b.x:=(c.x-(c.h-a.h-2)*a.x)/(c.h-a.h-1) else b:=c; end; procedure gc; var i:longint; a1,b1,c1:extended; begin if n>b.h then begin i:=b.h;a1:=a.x;b1:=b.x; end else begin i:=a.h;a1:=b.x;b1:=a.x; end; if n=b.h then begin writeln(trunc(b.x)); halt; end; if n=a.h then begin writeln(trunc(a.x)); halt; end; while i<>n do if i<n then begin c1:=a1+b1; a1:=b1; b1:=c1; inc(i); end else begin c1:=b1-a1; b1:=a1; a1:=c1; dec(i); end; writeln(trunc(c1)); end; begin zl; gc; end. |
|
|