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:
- Read the number of products n and the tolerance range k. Read the prices of the n products and calculate their sum. Calculate the average price by dividing the sum by n. Calculate the minimum possible price by subtracting k from the average price. Calculate the maximum possible price by adding k to the average price