22559_SimpleStatistics

2022-5-16 18:22| 发布者: Hocassian| 查看: 21| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506733962500-Problem List-采集的数据-后羿采集器.html

Pro.ID

22559

Title

Simple Statistics

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22559

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Given a set of numerical data, there are several ways in which to describe it. One way is the so-called 5-number summary. The five numbers used to describe the data set are the following: the minimum value, the first quartile, the median, the third quartile and the maximum value. The definition of the minimum and maximum values are obvious. The median of a set of numbers is the value of the number which would lie exactly in the middle of the set if it were sorted. For example, the median of the data set 7, -1, 9, 4, 1 would be 4. If there is an even number of values in the set, then the median is the average of the two values closest to the middle; if our set contained the values 7, -1, 9, 4, 1, 0 then the median would be (1 + 4)/2 = 2.5.

    The definition of the quartiles follows naturally from the definition of the median. If we take all the values that come before the median in the sorted list (in the case when we average two values for the median this set would include the lower of those two numbers) the first quartile is the median of this set. The definition of the third quartile is identical except it uses those values that come after the original median. In our example above with 7, -1, 9, 4, 1, 0, the first quartile value would be 0 (the median of the value -1, 1 and 0 which are less than 2.5) and the third quartile would be 7. If the data set contained 1, 2, 2, 2, 3 (in any order), then the median would be 2, and the first and third quartiles would be 1.5 and 2.5, respectively. One special case is when there is only one element in the list, in which case the quartiles are equal to the median.

    One other way to characterize data is its skewness. A distribution is considered right-skewed whenever the maximum value is farther from the median than the minimum value, or when the maximum and minimum are equally distant from the median, but the third quartile is farther from the median than the first quartile. A left-skewed distribution is one with the opposite situation. For our purposes, a distribution which is neither left-skewed nor right-skewed is considered symmetric. Your task for this problem is to read in various sets of numbers and output the 5-number summary for each, along with the skewness of the data.

    输入

    There will be multiple input sets. Each input set will consist of a single line of the form

    n  v1  v2  v3  . . . vn

    where n is the number of data values, and  v1 , ..., vn  are the values. All the values will be integers and the maximum value for n will be 100. A line which begins with 0 indicates end of input and should not be processed.

    输出

    Description

    Given a set of numerical data, there are several ways in which to describe it. One way is the so-called 5-number summary. The five numbers used to describe the data set are the following: the minimum value, the first quartile, the median, the third quartile and the maximum value. The definition of the minimum and maximum values are obvious. The median of a set of numbers is the value of the number which would lie exactly in the middle of the set if it were sorted. For example, the median of the data set 7, -1, 9, 4, 1 would be 4. If there is an even number of values in the set, then the median is the average of the two values closest to the middle; if our set contained the values 7, -1, 9, 4, 1, 0 then the median would be (1 + 4)/2 = 2.5.

    The definition of the quartiles follows naturally from the definition of the median. If we take all the values that come before the median in the sorted list (in the case when we average two values for the median this set would include the lower of those two numbers) the first quartile is the median of this set. The definition of the third quartile is identical except it uses those values that come after the original median. In our example above with 7, -1, 9, 4, 1, 0, the first quartile value would be 0 (the median of the value -1, 1 and 0 which are less than 2.5) and the third quartile would be 7. If the data set contained 1, 2, 2, 2, 3 (in any order), then the median would be 2, and the first and third quartiles would be 1.5 and 2.5, respectively. One special case is when there is only one element in the list, in which case the quartiles are equal to the median.

    One other way to characterize data is its skewness. A distribution is considered right-skewed whenever the maximum value is farther from the median than the minimum value, or when the maximum and minimum are equally distant from the median, but the third quartile is farther from the median than the first quartile. A left-skewed distribution is one with the opposite situation. For our purposes, a distribution which is neither left-skewed nor right-skewed is considered symmetric. Your task for this problem is to read in various sets of numbers and output the 5-number summary for each, along with the skewness of the data.

    Input

    There will be multiple input sets. Each input set will consist of a single line of the form

    n  v1  v2  v3  . . . vn

    where n is the number of data values, and  v1 , ..., vn  are the values. All the values will be integers and the maximum value for n will be 100. A line which begins with 0 indicates end of input and should not be processed.

    Output

    For each input set, output the 5-number summary and skewness in the order minimum, first quartile, median, third quartile, maximum and skew, with a single space between each. Skew will either be the phrase right-skewed, left-skewed or symmetric.

    Sample Input

    6 7 -1 9 4 1 0
    15 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
    15 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0
    0

    Sample Output

    -1 0 2.5 7 9 right-skewed
    1 4 8 12 15 symmetric
    0 4 8 12 15 left-skewed

    Source

    样例输入

    6 7 -1 9 4 1 0
    15 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
    15 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0
    0

    样例输出

    -1 0 2.5 7 9 right-skewed
    1 4 8 12 15 symmetric
    0 4 8 12 15 left-skewed

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部