HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


50874 - Apartment Building Administration - 2

Guest
• Review clarifications (12)

Section problems

• 51014 - Nine Men's Morris game
• 51019 - Finding the hidden message
• 50497 - Falling Bricks - Revisited
• 50933 - Sum of the Biggest Neighbors
• 51100 - Minimum time to exit building
• 50444 - n digit kth number divisible...
• 50865 - Apartment Building Adminis...
• 51089 - Multiply a row and add it to ...
• 50874 - Apartment Building Ad...
• 50531 - File Decryption
• 51012 - Palindrome-k
• 50469 - Letter Grades
• 50525 - Ordering Pizza
• 51099 - Mr. Monk
• 50468 - Draw Matrix - 2
• 51096 - Guess the number - 2
• 50448 - Paint Buckets

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.
Question by Ibrahim Mesecan.

Apartment Building Administration -2

Question: 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:

  • the number of apartments (n) and
  • the number of apartments (m)to calculate the result
  • the total amount to pay for all apartments.
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.

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 7683
3
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 is 5635 (2049 + 2049 + 1537) leke.



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

www.contester.ru