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#3, why!!!
Posted by Bobur 2 Mar 2008 16:08
var
    n, k, dn : byte;
    u, v, t : single;

begin
   read(n, k, u, v);
   t := (k - 1) * v + 15;
   if (n-1)*u < t+5 then n := 1
   else
     begin
       dn := TRUNC(t/u);
       t := t - dn * u;
       if u - t < v then inc(dn, TRUNC(t/(u-v)));
       dec(n, dn);
     end;
   if n < 1 then n := 1;
   writeLn(n);
end.

where is my wrong!!
pls give me tests!!

Edited by author 02.03.2008 18:44
Re: WA#3, why!!!
Posted by mai7 2 Mar 2008 23:26
Are you taking into concideration, time of taking Petya down to 1-st floor?
Re: WA#3, why!!!
Posted by Emil 2 Mar 2008 23:45
I've the same problem.
Please help if yoy have already korrected it!
Re: WA#3, why!!!
Posted by mai7 3 Mar 2008 03:04
How do you calculate time if he if going down to x-th floor?
Re: WA#3, why!!!
Posted by Emil 3 Mar 2008 18:20
i don't understand you.
Do you speak Russian??
help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Bobur 5 Mar 2008 00:04
i corrected it but i've WA#3 yet, please give me tests!!!

var
    n, k, dn : integer;
    u, v, t : real;

begin
   read(n, k, u, v);
   t := (k - 1) * v + 15;
   if (n-1)*u < t+5 then n := 1
   else
     begin
       dn := TRUNC(t/u);
       t := t - dn * u;
       dec(n, dn);
       if (n-1)*v*2+5+t>(n-1)*u then n := 1
       else
         if (n-1)*v*2+5+t=(n-1)*u then n := 2
           else
             if u <= 2 * v then n := 1
               else dec(n, TRUNC(t/(u-2*v)));
       if n < 1 then n := 1;
     end;
   writeLn(n);
end.
Re: help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Tolstobrov Anatoliy[Ivanovo SPU] 5 Mar 2008 02:47
Peter not required 15 seconds to leave Elevator
if he use Elevator he too not required 15 seconds to go out.
P.S. Bad English

Edited by author 05.03.2008 02:50
Re: help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Bobur 5 Mar 2008 22:37
i corrected my code, but yet WA#3, pls i need help!!!!!!!


var
    n, k, dn : integer;
    u, v, t : real;

begin
   read(n, k, u, v);
   t := (k - 1) * v + 15;
   dn := TRUNC(t/u);
   t := t - dn * u;
   n := n - dn;
   if (n - 1)*2*v+5+t>(n-1)*u then n := 1
   else
     if (n - 1)*2*v+5+t=(n-1)*u then n := 2
     else dec(n, TRUNC(t/(u-2*v)));
   writeLn(n);
end.
now, i've AC, but this is another way!!!
Posted by Bobur 6 Mar 2008 18:59