#K13536. Discounted Component Prices
Discounted Component Prices
Discounted Component Prices
You are given a set of components, each described by a string in the format name_price_discount
. Here, name is the component's name, price is an integer representing its original price, and discount is an integer percentage discount to be applied.
Your task is to calculate the discounted price for each component using the formula: $$\text{discounted price} = \text{round}\left(\text{price} - \text{price} \times \frac{\text{discount}}{100}\right)$$ and then output the result as name discounted_price
on separate lines.
inputFormat
The input is read from stdin and is structured as follows:
- The first line contains an integer
n
— the number of components. - The following
n
lines each contain a component description in the formname_price_discount
, where the underscore character (_
) separates the name, price, and discount percentage.
outputFormat
For each component, output a line to stdout containing the component's name and its discounted price, separated by a single space. The order of output should follow the order of input components.
## sample3
resistor_50_10
capacitor_100_25
inductor_200_15
resistor 45
capacitor 75
inductor 170
</p>