One Number for City Hall
City Hall wants a single number to show on lobby screens: today’s average outdoor temperature in Celsius.
Different departments send reports in mixed units - Celsius, Fahrenheit, and Kelvin - and they need your help to combine them.
The first line of the input contains a single integer n
- the number of temperature readings received.
Each of the next n
lines contains a value and a unit, separated by a space. The unit is one of C
, F
, or K
. Values can be integers or decimals.
Your program should convert every reading to Celsius, compute the arithmetic mean, and print it.
Input | Output |
---|---|
3 | 22.283 |
4 | 21.25 |
2 | 28.5 |
Conversions
C → C
:C
F → C
:(F - 32) * 5 / 9
K → C
:K - 273.15
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB