ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > BINF - CEN111 HW1 > задача:


6. 51060 - Public Transportation

Гость
• Вопросы к жюри (5)

Задачи сборника

• 1. 51055 - The competition
• 2. 51056 - Welcome Picnic
• 3. 51057 - Number of students
• 4. 51058 - Third grade students
• 5. 51059 - Football teams
• 6. 51060 - Public Transportation

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
bfs.

Q7

One of the public transportation companies operating in Tirana wants to see the bus name which has the highest profit while calculating daily total profits. This company has n buses working during the day. The ticket price changes according to the passenger categories as the follow:

  1. means Full ticket: 30 leke
  2. means Teacher ticket: 25.5 leke
  3. means Student ticket: 22.10 leke
  4. means Foreign student: free
  5. means Polis card: free
  6. means Elderly card: free

Input Specification: In the first line you will be given the number of all buses (n) 0 < n ≤ 500 working during the day and the fuel price (a floating point number “0.00<price≤999.99”).
The following n lines will contain the bus name, amount of fuel consumed that day (an integer between 1 and 110), and passenger’s categories separated by comma. There are at most 1000 passengers per bus where semicolon “;” indicates the end of the line.

Output Specification: Show the bus name with the highest profit and in the second line show total profit with two digits after the floating point.

Sample Input
4 1.6
bus_1 4 3, 3, 3, 3, 3, 3 ;
bus_2 7 2, 2, 2, 2, 2, 2, 6, 5, 6 ;
bus_3 8 5, 6, 1, 4, 1, 1, 4, 3, 6, 4, 6, 2 ;
bus_4 6 4, 4, 4, 4, 4, 4, 6, 6, 4, 5, 4, 3 ;
Sample Output
bus_2 141.80
405.30

Sample Input I Explanation:  

The number 4 indicates that there are 4 buses working and the fuel price is 1.6 leke. In the following first line there is a bus name “bus_1” followed by the amount of fuel consumed that day “4 lt”.  Other numbers in that line represent passenger’s categories.  All passengers in this bus are from the third category, so the ticket price for this category is 22.10 leke.

The profit for:

bus_1 is : (22.1 + 22.1 + 22.1 + 22.1 + 22.1 + 22.1) – (4*1.6) =132.6 - 6.4 =126.20
bus_2 is : (25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 0 + 0 + 0 ) – (7*1.6) = 153 - 11.2 = 141.80
bus_3 is : (0 + 0 + 30 + 0 + 30 + 30 + 0 + 22.1 + 0 + 0 + 0 + 25.5) – (8*1.6)=137.6 - 12.8=124.80
bus_4 is : (0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 22.1 ) – (6*1.6)=22.1 - 9.6=12.50

The bus with the heigest profit is: bus_2 and its profit is 141.80

Daily Total Profit=126.20+141.80+124.80+12.50=405.30

 
Для отправки решений необходимо выполнить вход.

www.contester.ru