Блог пользователя Sal3h.Sa3d

Автор Sal3h.Sa3d, история, 7 месяцев назад, По-английски

To solve this problem, we can apply a simple algorithmic approach. First, we calculate the sum of all the initial prices and divide it by the total number of products to find the average price. Then, we add the tolerance range ±k to the average price to obtain the minimum and maximum possible prices

Algorithm Explanation:

  1. Read the number of products n and the tolerance range k.
  2. Read the prices of the n products and calculate their sum.
  3. Calculate the average price by dividing the sum by n.
  4. Calculate the minimum possible price by subtracting k from the average price.
  5. Calculate the maximum possible price by adding k to the average price
Solution
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
7 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Sal3h.Sa3d (previous revision, new revision, compare).

»
7 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Sal3h.Sa3d (previous revision, new revision, compare).

»
7 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Sal3h.Sa3d (previous revision, new revision, compare).