#K76152. Discounted Movie Prices
Discounted Movie Prices
Discounted Movie Prices
You are given a list of movies, each described by four integers: \(P\), \(D\), \(min\), and \(max\). Here, \(P\) is the original price of the movie, \(D\) is the discount percentage, and \([min, max]\) represents the eligible price range for applying the discount. If \(P\) is within the range \(min \le P \le max\), the discount is applied, and the final price is computed as:
\(P_{final} = P - \frac{P \times D}{100}\)
Otherwise, the original price is maintained. Your task is to compute the final price for each movie.
inputFormat
The input is provided via stdin and consists of multiple lines. The first line contains a single integer (N), representing the number of movies. Each of the following (N) lines contains four integers separated by spaces: (P) (original price), (D) (discount percentage), (min) and (max) defining the valid price range for the discount.
outputFormat
Output the final prices of the movies on a single line, separated by spaces. The output should be written to stdout.## sample
1
100 10 80 120
90
</p>