Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. Prepared by Ibrahim Mesecan.
Difficulty Gamma
Product Info
Mr. Enea, sells building and sanitary materials. He stores all the products when bought in a room. And, while selling
he processes through his stock book. But, he wants to renew his system and to pass to computerized system.
Question: Write a program that is going to read the stock information. And, decide the most profited
(mostProfited) material and the number of remaining products (numRemained) in the store.
The profit of a certain product = (The number of items sold) * (Sell price - Entry price)
Note:
- mostProfited: is the item which has the biggest sum of profit
- numRemained: Some products are all sold. Every other item is an item remained in the stock.
numRemained is the count of the items remained in the stock.
Input specification
First, you will be given a number n, where 1 < n ≤ 5000, that shows the number of items in the store. Then,
in the following n lines you will be given semicolon separated product information. Product name and
category are string fields that may contain any ASCII char ending with a semicolon. Every line contains
- 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 (possibly space separated)
- Product category: At most 40 chars string (possibly space separated)
- Entry price: a floating point number
- Sell price: a floating point number
- Stock entry amount: The number of items when product first entered to the system, an integer number
- Amount sold: The number of items sold on different days. Space separated series of integers ending with a semicolon
The stock entry amount is an integer less than 10000 and the sum of the amount sold
will never exceed the stock entry amount.
and 10000
Output specification
Show the amount of the profit for the mostProfited product, and the number of (grand total of) remaining products.
Sample Input I
5
1; Flexible Pipe Connectors 6"; Connectors; 26.43; 34.62; 78; 3 9 6 2 9 2 4;
2; Barbed Fittings 4"; Fittings; 9.88; 10.96; 32; 5 6 9 7 5;
3; Small Tube Push Fit 7"; Fittings; 14.75; 17.85; 37; 2 8 4 3 5 8 7;
4; Clear Shower Mirrors 24"; Mirrors; 24.13; 29.19; 72; 4 4 3 3 5 6 9;
5; Lead Free Brass 4"; Fittings; 6.89; 9.64; 98; 3 5 6 4 3 7;
Sample Output I
286.65 3
|
Output Explanation :
Products 2 and 3 are all sold. There are 43 items remaining from Product 1; 38 items
remaining from product 4 and 70 items remaining from product 5. Thus, numRemained = 3
Product 1 is sold from the price $34.62 and its entry price is $26.43.
The profit per item is $8.19 and it has been sold 35 pieces. MaxProfitAmount = (35 * 8.19) = 286.65
Для отправки решений необходимо выполнить вход.
|