Most of the citizens of USA travels on their own vehicles everywhere. On the day of ThanksGiving, to reduce pollution government decided to increase a greater number of buses from high populated areas like California.
Each bus can accommodate 20 members. There are people waiting to travel for different places it is in given in the form of array. The number of buses provided by government also given from California.
Implement the logic, what is the minimum number of buses required to send everyone to home and Due to unavailability how many have left travelled on their own vehicles.
INPUT Format:
First Line of input as Number of Buses are allocated by government.
Take an array of numbers as people waiting to travel to other places (we don’t know the size of array) as second line
OUTPUT FORMAT:
Number of buses required for entire places
Number of people travelled on own.
INPUT1:
6
a 19 b 23 c 35 d 45 a 35
// a, b, c, d are just some town names. To avoid entire name, you can use some letters (a-z).
//Here a repeated more than once, it means it is different time.
//At one certain time , only one bus can be available
OUTPUT1:
10
58
// Explanation:
Number of buses required:
For a = 1 bus
For b = 2 buses
For c = 2 buses
For d = 3 buses
For a = 2 buses
Total number of buses are = 10 Buses
People travelling to place a = 0 , 1 bus
People travelling to place b = 0, 2 Buses
People travelling to place c = 0, 2 Buses
People travelling to place d = 25, 1 bus
People travelling to place a = 35.
0+0+0+25+15 = 60 People travelled on own
INPUT2:
8
n 34 m 42 d 10 h 76
OUTPUT:
10
36
//Explanation:
Need buses are : 2+3+1+4 = 10
People travelled on own:
n 2 buses, m 3 buses, d 1 bus, h 2 buses
so in h = 40 left , 36 remaining
Answers
Answered by
0
Answer:
46 is answer
Explanation:
because is buring 8+2 +36=46
Similar questions