CEN109/111_2016_Questions |
Start: Dec.07.2016 at 12:37:00 PM
Finish: Dec.07.2016 at 01:42:00 PM
The contest is finished!
• Contest scoreboard
|
Feedback | If you notice incorrect translations in Contester, please let author know.
|
|
Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. 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:
- means Full ticket: 30 leke
- means Teacher ticket: 25.5 leke
- means Student ticket: 22.10 leke
- means Foreign student: free
- means Polis card: free
- 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
Для отправки решений необходимо выполнить вход.
|