Comfy Deviations
InterviewTime limit1sMemory limit512 MB
Read 10 temperatures, compute the sample standard deviation with n-1, and print COMFY if it is at most 1.0, otherwise NOT COMFY.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
According to Wikipedia, standard deviation is a number used to tell how measurements for a group are spread out from the average (mean or expected value). A low standard deviation means that most of the numbers are close to the average, while a high standard deviation means that the numbers are more spread out. For this problem, you will read in 10 temperature values and use the standard deviation to determine if the values are close to the mean temperature. The formula for calculating the standard deviation is:
- = Standard deviation of temperature values
- = The number of data points (10 in this case)
- = Each of the input temperature values
- = The average (mean) of all 10 input values.
Input
Input consists of a single line containing 10 space separated floating point values representing the temperature values to check.
Each temperature value, will be in the range ()
Output
The output consists of a single line that has the string COMFY if the standard deviation of the input values is ≤ 1.0 or NOT COMFY if the standard deviation of the input values is > 1.0.