HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50865 - Apartment Building Administration

Guest
• Review clarifications (1)

Volume problems

• 50513 - Climbing Up the Stairs
• 50854 - Area of Triangle Revised
• 50520 - Filling a Matrix Randomly
• 50497 - Falling Bricks - Revisited
• 50847 - The first m trains to leave
• 50669 - Area of an Irregular Polygon
• 50860 - Number of Student Certificates
• 50444 - n digit kth number divisible...
• 50865 - Apartment Building Ad...
• 51011 - Decoding the Path
• 51019 - Finding the hidden message
• 51002 - The most successful classes
• 50525 - Ordering Pizza
• 50342 - 100 Factorial
• 50524 - Elevator
• 50531 - File Decryption
• 50758 - National Elections - Revisited

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

Question: Administrator of a block of apartments has come to you for a program. The water consumption of the apartments is calculated according to the people staying 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 10. (If there are more than 10 people, it is count as 10). 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 a number: the number of apartments (n). Then in the following n lines you will be given the number of people living in n-apartments. Then, you will be given total amount to be paid for all apartments (a floating point number). On the next line the number of apartments (m) to calculate the total amount is given. In the following m lines, you will be given the numbers of m apartments where 0 ≤ m ≤ n ≤ 2000.

Output specification:
Show the total amount to be paid by m apartments. Note: When calculating the amount for each apartment, round total for each apatment to the nearest integer.

Sample Input I
6
3
4
0
2
1
4
7683
3
2
4
5
Sample Output I
3585

Explanation: There are 14 people in all the apartments. However, there is nobody in Apartment number 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, apartments 2, 4, and 5. There are

  • 4 people living in Apartment:2, amount to pay is 2049
  • 2 people living in Apartment:4, amount to pay is 1024
  • 1 people living in Apartment:5, amount to pay is 512
Then, the total amount to pay by the m-apartments is (2049 + 1024 + 512) = 3585



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

www.contester.ru