|
|
back to boardDiscussion of Problem 1113. JeepWhy 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? (-) Re: Why Crash???????? 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 |
|
|