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 1602. Elevator

WA 7 Whats wrong?
Posted by tanas 3 Jun 2008 20:19
This is my program. I have read all forum but didn't find answer. Please help

{$Q-,R-,S-,I-,O+}
program z1602;
uses math;
var
  a: array [1..101] of extended;
  u, v, k, min: extended;
  pos, i, n: longint;
begin
    read(n,k,u,v);
    a[1]:= (n-1)*u;
    for i := 2 to n do
      a[i]:= max((n-i)*u,(k-1)*v+15)+(i-1)*v+5+(i-1)*v;
    min:= a[1]; pos:= 1;
    for i := 2 to n do
      if a[i] + 1e-9 < min then
      begin
        min:= a[i];
        pos:= i;
      end;
    writeln(pos);
end.
Re: WA 7 Whats wrong?
Posted by [LG]_#\#@P$T[101]R 6 Jul 2008 02:40
read problem more attentively. when you find pos, you way from 2 to N, but right way from N downto 2... and you get AC :)

Edited by author 06.07.2008 02:43