|
|
back to boardShow all messages Hide all messagesHi I had solved this problem with just 3 shortint... It so easy look other messages in this problem to understand what is happening! All you need is: dec(n,n mod y); where y is that K[i]`s which described in problem. nothing is special for this problem... With best Wishes Aidin_n7@hotmail.com This way is so incredible! Could you explain why it's correct and what does this problem mean? Thanks. Obviously, distance between cop and robber can only decrease. If cop cannot overtake robber at current stage(if L >= k[i]), so new min distance in the best case for policeman will be equal to (minimum amount of trams)*k[i]. And minimum amount of trams is L mod k. For instance, L=7, K=3, so policeman will miss at least 2 trams: robber will reach tram stop, wait at most 3 mins and go away. Policeman will miss next tram, and he should wait another 2 mins before next tram will come. So, new L = 2*K = 6. But minimum amount if trams is [L/k[i]], not L%k[i] Oo |
|
|