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 1113. Jeep

Why Crash????????
Posted by kkkkk 23 Oct 2004 19:24
var m,n,t:integer;
    out:double;
    way:array[1..100]of double;
    oil:array[1..100]of longint;
begin
     readln(n,m);
     way[1]:=m;
     oil[1]:=m;
     t:=2;
     while way[t-1]+m/(2*t-1)<n do
         begin
              way[t]:=way[t-1]+m/(2*t-1);
              oil[t]:=t*m;
              inc(t);
         end;
     out:=(n-way[t-1])*(2*t-1)+oil[t-1];
     if abs(out-trunc(out))<1e-8 then
        writeln(trunc(out))
                                 else
        writeln(trunc(out)+1);
end.
Enlarge your arrays. Why 100? (-)
Posted by Michael Rybak (accepted@ukr.net) 27 Oct 2004 17:06
Re: Why Crash????????
Posted by xurshid_n 22 Dec 2005 17:45
Size array take 32000!!!
i.e
way: array[1..32000]of double;
oil: array[1..32000]of longint;


Edited by author 22.12.2005 17:45

Edited by author 22.12.2005 17:45