i have trouble understanding this problem . can any one explain? thanks :)
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3831 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | gamegame | 3386 |
10 | ksun48 | 3373 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 153 |
i have trouble understanding this problem . can any one explain? thanks :)
Название |
---|
The secret costs n marks.
Now, the unlucky buyer does not have coins such that it is possible to pay exactly n marks. But he has enough coins to pay more than n marks. He will also use as few coins as possible to pay more than n marks.
Now you want to find what might be the worst possible case for the unlucky buyer. You want to find out the maximum number of coins the unlucky buyer might be forced to pay.
For example, if the cost of the secrets is 15.
The unlucky buyer must have enough money to pay more than 15 marks. But he must not be able to pay exactly 15 marks.
If he has 5 coins of 3, then he will be able to pay exactly 15. Therefore, we must not consider this case at all. If he has 2 coins of 9, 1 coin of 3, 2 coins of 1, then he will use 2 coins of 9 to pay 18 marks. If he has 1 coin of 27, he will use 1 coin of 27 to pay 27 marks.
The worst possible case, such that the unlucky buyer can pay more than 15, is when he has to pay using 2 coins of 9.
thanks :)
let's consider all the combinations with this conditions :
in this problem you should calculate maximum number of coin between valid combinations.
thanks ,it was beneficial :)