Submit | All submissions | Best solutions | Back to list |
EI20213FQ1 - Products Average Selling Price |
You are given a list of transactions, each of them includes transaction code, product code, selling price, and quantity. Your task is to write a program to print the average selling price for each product.
Input
- The first line contains one integer N - the number of transactions (1 ≤ N ≤ 105).
- Each line in the next N lines contains four integers representing a transaction. All of them are not exceed 109
Output
For each product, print out the product code and the average selling price. The list of products should be sorted in descending order of the average selling price and ascending order of product code.
The average selling price should be rounded to the nearest unit in output.
Sample
https://drive.google.com/file/d/1FxLZ8UOSPlX9S0m2ixiRoFD35bOxvbVV/view?usp=sharing
Input |
Output |
5 1111 1 1000 2 1112 2 100 1 1113 1 500 10 1114 2 99 1 1115 3 100 2
|
1 583 3 100 2 100
|
Added by: | Ha Minh Ngoc |
Date: | 2021-07-18 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET |