#C10386. Rainfall Difference Calculation
Rainfall Difference Calculation
Rainfall Difference Calculation
Given a multi-line input containing city names along with their corresponding rainfall measurements, compute the difference between the maximum and minimum rainfall values. Specifically, if the rainfall values are denoted by (R_i), then the required result is (\text{difference} = \max(R_i) - \min(R_i)). If only one city's data is provided, the difference is considered to be 0.00. The input is provided via standard input and the answer must be printed to standard output.
inputFormat
The input is read from standard input (stdin) as multiple lines. Each line is in the format: CityName Amount
, where CityName
is a string and Amount
is a floating-point number representing the rainfall. For example: Tokyo 1523.4
.
outputFormat
Output a single floating-point number to standard output (stdout) representing the difference between the maximum and minimum rainfall values, rounded to two decimal places.## sample
Tokyo 1523.4
Nagoya 1282.7
Osaka 1335.5
Kyoto 1689.2
Hokkaido 923.1
766.10