ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1133. Fibonacci Sequence

Help! WA 16. Here my code.
Posted by Iosif inf-10 6 Nov 2008 13:23
Var
i,j,n,Fi,Fj:longint;
Fi1,Fn:extended;
k:integer;
F:array[-2001..2001] of extended;
Begin
  Readln(i,Fi,j,Fj,n);
  F[0]:=0; F[1]:=1;

  for k:=2 to 2001 do
  F[k]:=F[k-1]+F[k-2];

  for k:=-1 downto -2001 do
  F[k]:=F[k+2]-F[k+1];

  Fi1:=((Fj-F[j-i-1]*Fi)/F[j-i]);
  Fn:=(F[n-i]*Fi1+F[n-i-1]*Fi);
  writeln(round(Fn));
End.

Why WA#16?

Edited by author 06.11.2008 13:26