[problem 93] Starving Priority Queue

Back to General discussions forum

Mastermind     2016-01-09 02:36:34

"Input data contain N - number of visitors and X0 - the seed for randomizer in a single line.
Answer should contain a single value - total discomfort of people who come this day to Abbey.

Example:

input data: 7 0

answer: 7572"

But for 7 visitors and seed = 0:

t = 0 - visitor with degree 9 came
t = 1 - visitor with degree 9 came
t = 2 - visitor with degree 9 left (+18), visitor with degree 4 came
t = 3 - visitor with degree 6 came
t = 4 - visitor with degree 9 left (+27), visitor with degree 4 came
t = 5 - visitor with degree 8 came
t = 6 - visitor with degree 8 left (+8), visitor with degree 6 came
t = 8 - visitor with degree 6 left (+30)
t = 10 - visitor with degree 6 left (+24)
t = 12 - visitor with degree 4 left (+40)
t = 14 - visitor with degree 4 left (+40)
----- -----
total: 187

187 != 7572

Where did 7572 came from?

Mastermind     2016-01-09 04:39:41

Oh! Topic can be closed, i've missed that in example there was "by module 9" instead of 999 ><

Please login and solve 5 problems to be able to post at forum