CEN_114 Midterm A |
Старт: 14.мая.2020 в 00:00:01
Финиш: 31.мая.2020 в 23:55:59
Турнир завершён!
• Турнирная таблица
|
|
Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Use Classes to solve the problem.
Semicolon Separated Product Info
Mr. Enea, sells building and sanitary materials. After selling the products
he processes through his stock book. But, he wants to renew his system and to pass to a computerized system.
Question: Write a program that is going to read the stock information.
And, show the most sold top m items.
Note: Use Quick sort to solve the problem.
Input specification
First, you will be given two numbers n and m, where
- 1 < n ≤ 5000, that shows the number of items in the store
- 1 < m ≤ 50, where m is the number of items to show on screen.
Then, in the following n lines you will be given semicolon separated product information. Every line contains the following information:
- Product ID: Every product is given a product ID on its entry. an integer number smaller than 10 million
- Product name: At most 40 chars string. It may contain any ASCII char ending with a semicolon.
- Product category: At most 40 chars string. It may contain any ASCII char ending with a semicolon.
- Entry price: a floating point number
- Sell price: a floating point number
- Amount sold: The number of items sold on different days. Space separated series of 5 integers
Output specification
Show
- the Product ID
- the total amount sold
of the top m items in decreasing order of amount sold.
Sample Input
5 3
1; Wall Mount Faucet 4"; Faucets; 21.50; 27.52; 8 8 3 17 2;
2; Sharkbite Fittings 8"; Fittings; 9.11; 10.11; 13 4 21 23 11;
3; Murano Vessel Lavatory - White; Vessels; 9.71; 12.73; 16 4 25 6 11;
4; Barbed Fittings 7"; Fittings; 17.80; 19.94; 3 21 7 5 20;
5; Contemporary Lever Handles; Shower Arms; 1.75; 2.14; 1 9 17 5 25;
Sample Output
2 72
3 62
5 57
|
Output Explanation :
Product 2 is the most sold product: 72 pieces of it has been sold.
That is followed by the products 3 and 5.
Для отправки решений необходимо выполнить вход.
|