DWITE Online Computer Programming Contest
November 2002

Problem 1

Sales! Sales! Sales!

You are to determine which item at a store, out of a group of three items which are on sale, offers the best discount as a percentage out of 100.

Input

The input will contain data sets for five separate sales. Each sale will contain three pairs of data. Each pair will contain two lines, one for the regular price of an item and the other for the sales price of an item, in that order. The regular price will always be greater than the sales price.

Output

The output will contain five lines of data, each representing the percentage discount of the item that offers the greatest discount. The percentage is displayed out of 100 (no percent sign needed), rounded to 3 decimal places, right justified in a field width of 7.

Sample Input

(only two sales given)

10.00
9.55
10.00
9.25
10.00
9.45
44.50
22.25
50.00
24.00
60.00
31.00

Sample Output

  7.500
 52.000

All Submissions
Best Solutions


Point Value: 5
Time Limit: 1.00s
Memory Limit: 32M
Added: Mar 25, 2009

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

what does "right justified in a field width of 7." mean? I think I am getting the question wrong due to this requirement for the output, but what does it refer to?

It means the output should be 7 columns wide and padded with spaces on the left, as shown in the sample output.