All problems

Enforcing a Valid Price Range

easyPythonNumPynp.clip

Riverbend Supply lists third-party sellers on its marketplace, and a seller's own pricing tool occasionally sends a figure the shop refuses to display: a giveaway under $5, or a typo over $50. Rather than reject the listing outright, the shop pulls the price back to the nearer end of its allowed band and shows that instead. A price already between $5 and $50, both ends included, is shown exactly as it was sent. Every listing keeps its place in the feed, whatever happened to its price.

Task: Print the prices the shop will display, in feed order.

Input

The first line holds a single integer n, the number of listings. Each of the next n lines holds one price in dollars, which may carry decimals.

Output

One line holding all n prices in feed order, separated by single spaces, each with two digits after the decimal point. A price under $5 shows as 5.00, and a price over $50 shows as 50.00.

Example:

Input:
4
2
30
60
45

Output:
5.00 30.00 50.00 45.00

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…