Diferente pentru problema/fairgame intre reviziile #1 si #5

Nu exista diferente intre titluri.

Diferente intre continut:

== include(page="template/taskheader" task_id="fairgame") ==
Poveste şi cerinţă...
Alice and Bob are playing a game. They have a pile of N rocks. Alice makes the first move, then Bob does the second, and so on... In each turn, the player that has to move takes at least 1 rock and maximum K rocks. If one takes an odd number of rocks, then they have to pay M dollars. When the pile is empty, the player who made the last move gets P dollars and the other one gets Q dollars. After the game ends, Alice will end up with an amount of dollars, let's call it X, and Bob will end up with another amount of dollars, let's call it Y. Knowing that they play optimally, which means Alice wants to maximize the number X - Y Bob wants to minimize this number, then find out X - Y after the game ends.
h2. Date de intrare
Fişierul de intrare $fairgame.in$ ...
On the first line of input in the file $fairgame.in$ there are the values of N, K, M, P, Q in this order.
h2. Date de ieşire
În fişierul de ieşire $fairgame.out$ ...
On the first line of the output file $fairgame.out$ the value of the difference in dollars between Alice and Bob should be written
h2. Restricţii
* $... ≤ ... ≤ ...$
* $1 ≤ N, K, M, P, Q ≤ 5 * 10^6$
* Pentru 30 puncte, $N ≤ 4000
* Pentru alte 10 puncte, N ≤ 10000, K ≤ 900
* Pentru alte 20 puncte, N ≤ 10000
h2. Exemplu
table(example). |_. fairgame.in |_. fairgame.out |
| This is some
  text written on
  multiple lines.
| This is another
  text written on
  multiple lines.
| 6 3 5 4 2
| 2
|
h3. Explicaţie

Nu exista diferente intre securitate.

Topicul de forum nu a fost schimbat.