Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. 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
Для отправки решений необходимо выполнить вход.
|