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

Why I got Crash (FLT_INVALID_OPERATION) help me!!!
Posted by Badd 28 Feb 2002 08:44
const inp = '1133.in';
      maxgen = 2005;
var   fname : text;
      l,itemp   : longint;
      i,j,to_,t : extended;
      ii,jj,tt         : extended;
      f,ff                : extended;
      gen                : array[0..maxgen] of extended;
procedure gendat;
var l : longint;
 begin
      gen[0]:=0; gen[1]:=1;
      for l:=2 to maxgen do
          gen[l]:=gen[l-1]+gen[l-2];
 end;
procedure process;
var temp : extended;
 begin
      t:=i;
      f:=ii; ff:=tt;
      while (t<>to_) do
            begin
                 if t<to_ then
                    begin
                         temp:=f+ff;
                         f:=ff;
                         ff:=temp;
                         t:=t+1;
                    end
                 else
                     begin
                          temp:=ff-f;
                          ff:=f;
                          f:=temp;
                          t:=t-1;
                     end;
            end;
      writeln(f:0:0); halt;
 end;
begin

     readln(i,ii,j,jj,to_);

     if j<i then
        begin
             t:=i; tt:=ii;
             i:=j; ii:=jj;
             j:=t; jj:=tt;
        end;
     gendat;
     if gen[trunc(j-i-1)]*ii<jj then
        t:=1
     else t:=-1;
     itemp:=trunc(abs((gen[trunc(j-i-1)]*ii)-jj)) div trunc(gen[trunc(j-i)]);
     tt:=itemp;
     tt:=tt*t;
     process;
end.
Re: Why I got Crash (FLT_INVALID_OPERATION) help me!!!
Posted by TheBlaNK 1 Mar 2002 17:36
i used to submit this problem and got WA

i guess that u forget to think ordinary fibo(n)
if(n>100) it can't keep in long
Ho Ho ...........:-)
Posted by TheBlaNK 1 Mar 2002 17:37
> i used to submit this problem and got WA
>
> i guess that u forget to think ordinary fibo(n)
> if(n>100) it can't keep in long