Pagini recente » Diferente pentru problema/canguri intre reviziile 3 si 4 | Diferente pentru utilizator/andreea1cool intre reviziile 13 si 14 | Diferente pentru utilizator/mihaibogdan10 intre reviziile 9 si 6 | Diferente pentru utilizator/gerd13 intre reviziile 10 si 11 | Diferente pentru problema/monopoly intre reviziile 42 si 15
Nu exista diferente intre titluri.
Diferente intre continut:
your magic dice to cheat.
The game is played on a board, made of $N$ cells arranged in a circle. The cells are numbered from $0$ to $N-1$, with cells $N-1$ and $0$ being adjacent.
Each cell has a tax value <tex> T_i </tex> associated with it. Every time a player lands on a cell, he has to pay the tax value of that cell (the tax value can be negative, meaning that the player receives money).
Each cell has a tax value T ~i~ associated with it. Every time a player lands on a cell, he has to pay the tax value of that cell (the tax value can be negative, meaning that the player receives money).
Carlo starts on cell $0$ and will play $K$ turns of monopoly. Each turn he rolls two $6$-sided dice and moves forward by the sum of the two values.
He then pays the tax value of the cell he lands on. If the two dice value are equal, after moving and paying, he {**must**} continue and roll the dice again.
h2. Date de intrare
The first line contains the integers $N$ and $K$.
The second line contains $N$ integers <tex> T_i </tex>.
The first line contains the integers $N$ and $K$ (1 &le $N$ &le 1000), (1 &le $K$ $le 1000).
The second line contains $N$ integers T ~i~ (-10^9^ &le T ~i~ &le 10^9^).
h2. Date de ieşire
You need to write a single line with an integer: the amount of money Carlo loses during the game.
În fişierul de ieşire $monopoly.out$ ...
h2. Restricţii
* 1 ≤ $N$ ≤ $1000$
* 1 ≤ $K$ ≤ $1000$
* -10^9^ ≤ <tex> T_i </tex> ≤ 10^9^
* For the first subtask, $K = 1$.
* For the second subtask, (1 ≤ $N$ ≤ $100$), (1 ≤ $K$ ≤ $100$).
* $... ≤ ... ≤ ...$
h2. Exemplu
table(example). |_. monopoly.in |_. monopoly.out |
| 11 1
0 5 4 12 6 3 15 7 2 20 5| 47|
|12 1
-10 -20 -4 -6 -15 -20 -20 -20 -20 -20 -20 -20| -6|
|2 2
999999999 1000000000| 5999999998|
| This is some
text written on
multiple lines.
| This is another
text written on
multiple lines.
|
h3. Explicaţie
In the {**first sample case**} the answer is $47$. A possible sequence of rolls is the following:
* Carlo rolls $3$ and $3$ and moves to cell $6$, with tax value $15$. Since the $2$ dice values are equal he must throw again.
* Carlo rolls $4$ and $4$ and moves to cell $3$, with tax value $12$. Since the $2$ dice values are equal he must throw again.
* Carlo rolls $3$ and $3$ and moves to cell $9$, with tax value $20$. He already moved $3$ times, so his turn ends, even if the $2$ dice values are equal.
In the {**second sample case**} the answer is $-6$. A possible sequence of rolls is the following:
* Carlo rolls $1$ and $2$ and moves to cell $3$, with tax value $-6$. Then his turn ends.
Note that going to the cell $2$ is not optimal because the only way to do so is by rolling $1$ and $1$, but that forces Carlo to move again.
...
== include(page="template/taskfooter" task_id="monopoly") ==
Nu exista diferente intre securitate.
Topicul de forum nu a fost schimbat.