Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. 50458 - IMPC13 - Group Contest 14-01-30.
Weekly Report
Mr. Alban Mataj has a supermarket. Whenever an item is
sold through the chasier, its number is decreased
automatically from the database.
Time to time, to check his balance, he counts the items in the
supermarket and prepares report.
Question: Write a program that
gets the number of items for this week followed by the price
of each item. And then, it gets the number of items from
the previous week. Then, the program calculates the
number of total items sold and total amount of money
got in that week.
Note:
Input specification
You will be given one integer number (n) at the
beginning where 1 ≤ n ≤ 40000. Then, in the following
n lines, you will be given two numbers,
information about every item:
- the number (count) of items this week (integer)
- the price of this item (floating point number)
the following n lines give the previous count of items.
Output specification
Show two numbers (an integer number and a floating point number):
- total items sold this week and
- total revenue for this week
Note: Show total revenue with
at most 2 digits precision after the floating point.
Sample Input I
4
5 2.2
10 2
9 1.2
4 3
10
12
15
6
|
Sample Input II
5
19 2.8
20 1.1
10 1.9
15 0.4
19 2.1
26
26
16
23
23
|
Sample Output I
15 28.2
|
Sample Output II
31 49.2
|
Explanation (Sample 1) :
There are 4 items.
Item ID | Last week |
This week | Price |
NumSold | Total |
1 | 10 |
5 | 2.2 |
5 | 11 |
2 | 12 |
10 | 2 |
2 | 4 |
3 | 15 |
9 | 1.2 |
6 | 7.2 |
4 | 6 |
4 | 3 |
2 | 6 |
Для отправки решений необходимо выполнить вход.
|