|
|
Show all threads Hide all threads Show all messages Hide all messages | Don't use DOUBLE!!!! | Valentin (PSU) | 1602. Elevator | 24 Mar 2008 12:06 | 2 | Why don't?) My friend solved this problem using double during the contest. But I used long) It's no matter, IMHO) | Statement needs correction!! | wap | 1602. Elevator | 7 Mar 2008 22:25 | 1 | The indicator above the elevator door shows that the elevator is now going down to the first floor and is at the level of the kth floor 'IS NOW GOING DOWN' means the elevator is going down at the moment Petr is at the nth floor, when he hasn't called the elevator yet. This cause a big misunderstanding! I almost banged my head to the wall that I got the answer 44 on the example case every time. It also gives me a +1, :P. It would be better if it's changed to The indicator above the elevator door shows that the elevator WILL GO down to the first floor WHEN CALLED and is at the level of the kth floor If I misunderstand the task, please inform me. Thank you Edited by author 07.03.2008 22:32 | WA#3, why!!! | Bobur | 1602. Elevator | 6 Mar 2008 18:59 | 9 | 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 Are you taking into concideration, time of taking Petya down to 1-st floor? I've the same problem. Please help if yoy have already korrected it! How do you calculate time if he if going down to x-th floor? i don't understand you. Do you speak Russian?? 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. 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 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. | No subject | Anastas | 1602. Elevator | 3 Mar 2008 22:22 | 1 | Edited by author 10.03.2008 22:03 | What's wrong in calculating total time? | mai7 | 1602. Elevator | 3 Mar 2008 03:02 | 3 | double tt(int x) { double mt=(u*(n-x)>(k-1)*v+15)?u*(n-x):((k-1)*v+15); return mt+5.0+(x-1)*v; } and after calculation x, that gives the best result, i comparse this to (n-1)*u [situation, when it's optimal to go by foot to first floor]. Edited by author 02.03.2008 04:01 Edited by author 02.03.2008 04:01 Be careful in the precision of Double |
|
|
|