ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Linear Data Structures: Arrays > задача:


50318 - Product Info

Гость
• Обсуждение задачи (1)

Задачи раздела

• 50419 - The longest bitonic sequence
• 50326 - Matrix Operations
• 50329 - Draw Matrix-1
• 2 ->10
• 50592 - Shumezimi i Matricave
• 50606 - Длинное произведение
• 50607 - Длинная сумма
• 50319 - Toll Plazas
• 50318 - Product Info
• 50360 - National Elections
• 50337 - Exam Averages
• 50567 - Normalizimi Min Max

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Prepared by Ibrahim Mesecan. Сложность Гамма

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:

  1. mostProfited: is the item which has the biggest sum of profit
  2. 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

  1. Product ID: Every product is given a product ID on its entry. an integer number smaller than 10 million
  2. Product name: At most 40 chars string (possibly space separated)
  3. Product category: At most 40 chars string (possibly space separated)
  4. Entry price: a floating point number
  5. Sell price: a floating point number
  6. Stock entry amount: The number of items when product first entered to the system, an integer number
  7. 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


Для отправки решений необходимо выполнить вход.

www.contester.ru