|
|
вернуться в форумWho can help me???(pascal) Послано New CD 18 дек 2002 10:55 {$n+} program ti; type data = record x,y:extended; end; var ii,jj,n,i:longint; fj,xx,fi:extended; a:array[-1000..1000]of data; procedure cl; var t:longint; tt:extended; begin tt:=fi; fi:=fj; fj:=tt; t:=ii; ii:=jj; jj:=t; end; procedure cl2; var i:longint; begin if n<ii then begin for i:=ii-1 downto n do begin a[i].y:=a[i+2].y-a[i+1].y; a[i].x:=a[i+2].x-a[i+1].x; end; end; if n>jj then begin for i:=jj+1 to n do begin a[i].y:=a[i-2].y+a[i-1].y; a[i].x:=a[i-2].x+a[i-1].x; end; end; write(a[n].y*fi+a[n].x*xx:0:0); end; begin for i:=-1000 to 1000 do begin a[i].y:=0; a[i].x:=0; end; read(ii,fi,jj,fj,n); if n=ii then begin write(fi:0:0); halt; end; if n=jj then begin write(fj:0:0); halt; end; if ii>jj then cl; a[ii].y:=1; a[ii].x:=0; a[ii+1].y:=0; a[ii+1].x:=1; for i:=ii+2 to jj do begin a[i].y:=a[i-1].y+a[i-2].y; a[i].x:=a[i-1].x+a[i-2].x; end; xx:=(fj-a[jj].y*fi)/a[jj].x; cl2; end. |
|
|