MWC '15 #5 P1: Stats

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 256M

Problem types
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

You have just finished your edge case test in ICS. Since you are an exceptional student, your teacher has given you an extra assignment:

Find the mean, median and mode of all the test scores.

Since it's absurd to do this manually, you have burdened yourself with creating a computer program!

The mean is an average (total score divided by number of tests). The median is the middle score, or the average of the two middle scores if there is an even number of tests. The mode is the score that occurs most often. If multiple scores occur most often, then all of them are considered modes.

Input Specification

The first line will contain a single integer N (1 \le N \le 100), the number of tests.

The second line will contain N numbers, M_n (0.0 \le M_i \le 100.0), the score that nth person received, as a percent rounded to the nearest tenth.

Output Specification

Three lines in the following order:

  • The mean of all the test scores
  • The median of all the test scores
  • The mode(s) of all the test scores in ascending order

Output will be accepted within a margin of error of 0.1.

Sample Input

50 60 70 50 70

Sample Output

50 70

Explanation for Sample Output

Everyone got rekt by the edge case test, so the average was (50 + 50 + 60 + 70 + 70) / 5 = 300 / 5 = 60. The median is also 60. The modes: 50 and 70 both occurred the most with 2 times.


  • 0
    TypicalToxic  commented on Oct. 10, 2016, 11:45 p.m.

    What is test case #11 and #13????????!!!!

  • 0
    Jeffmagma  commented on April 23, 2016, 12:41 p.m.

    Are there any constraints for the amount of marks?

    • 2
      aurpine  commented on April 23, 2016, 3:10 p.m.

      1 \le N \le 100