VPEX P2 - Darcy Parties

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type
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

Darcy is celebrating his IOI platinum medal. At his party, he tried split up his cake into many slices and distributed the slices equally. However, his supervisor Eric noticed that Darcy accidentally gave some people an incorrect amount of slices. Calculate how many times Darcy made a mistake.

Input specification

The first line contains N, the number of people at the party. The next line contains N integers, each integer x_i representing the number of slices of cake the ith person has.

It is guaranteed that the total number of slices will be divisible by the number of people at the party.

Output specification

Output the number of people who did not recieve the number of slices they should have recieved if the cake was divided equally.


1\le N,x_i\le 10

Sample Input

1 3 2 2 2

Sample Output



If the slices were evenly distributed, everyone would recieve 2 slices. Darcy only gave 1 slice to person 1, and gave the extra slice to person 2.


There are no comments at the moment.