Блог пользователя infinity_hsn

Автор infinity_hsn, история, 14 месяцев назад, По-английски
input
1 3 7 19
2 3
2 5
4 4 4
output
12

In this problem, we have to find the minimum sum of burles Vasya will spend. According to this example, the output should be 12. Still, I think it is wrong because if we buy 5 tickets of the first type, he only has to pay 5 burles or the second way is to buy 2 tickets of the first type for the buses and the second type of ticket for the trolley, as they have the same number so they will be considered as 1. Therefore, we get 1*3 + 2*1 = 5. Can someone please tell me if am I right or I am missing something or the example is wrong?

  • Проголосовать: нравится
  • -17
  • Проголосовать: не нравится

»
14 месяцев назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится

So you think the example has been wrong for 11 years and nobody fixed it?

»
14 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

the first type of ticket only allows for 1 ride on 1 transport. So you need 19 tickets of first type and not 5 as you said.

»
14 месяцев назад, скрыть # |
 
Проголосовать: нравится +20 Проголосовать: не нравится

You have to spend 2 burles for the first bus ($$$C_1 * 2$$$)

Take the unlimited number of rides for the second bus ($$$C_2 * 1$$$)

Take the unlimited number of rides for all the trolleys ($$$C_3 * 1$$$)

The result will be 12, you can see that this is the minimum possible cost