| Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. Question by Ibrahim Mesecan.
 
 
   Apartment Building Administration -2Question:
Administrator of a block of apartments (and offices) 
has come to you for a program. The water consumption 
of the apartments/offices 
is calculated according to the people living in the 
apartments. There is minimum and maximum limit for the number
of people living. Even if there is no body living in an 
apartment, it is count at least one person living there. 
The highest number of people used in calculations is 20. 
(If there are more than 20 people in an office or apartment, 
it is count as 20 people). 
Then, the usage per person is the total amount for all 
apartments divided by the number of people in all 
apartments. The amount  to pay for one apartment is 
the number of people times amount per person. 
 
Write a program that reads the information for the 
building and calculates the total amount due for 
m-apartments given.
 Input specification  You will be first given three numbers:
 
where n and m are integers 0 ≤ m ≤ n ≤ 10,000. 
And the total amount to pay is a floating point number between 0 
and 1,000,000. Then, in the following n lines you will be 
given the number of people living in n-apartments.the number of apartments (n) and the number of apartments (m)to calculate the resultthe total amount to pay for all apartments. Output specification: Show the total amount to be paid for top m apartments.
Note: When calculating
the amount for each apartment, round to the nearest
integer.
 
  | Sample Input I 
 
6 3 76833
 4
 0
 2
 1
 4
 | Sample Output I 
 
5635 
 |   Explanation:  There are 14 people 
in all the apartments. However, there is nobody in Apartment-3. 
And, it is count as 1 person. So, the result is calculated
out of 15 people. The amount per person is 512.2 (total amount 
to pay (7683) divided by 15) leke. The amount due from 3 apartments 
is asked. Total number of people in m apartments in the sorted 
list is 11 (4 + 4 + 3). Then, the total amount to pay 
for top m apartments is5635 (2049 + 2049 + 1537)leke. 
 Для отправки решений необходимо выполнить вход.
 
 
 |