ECOO '17 R1 P1 - Munch 'n' Brunch

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 30.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
Author: Andrew Seidel

Student council is looking to organize a school brunch, where the proceeds will be put towards a year-end trip for the graduating class. The council members decide that the price depends on how many years you have been at the school. For someone who has been at the school for one year (Y_1), the price will be \$12, for someone who has been at the school for two years (Y_2), the price will be \$10, the three-year (Y_3) price will be \$7, and the price for someone who has been there all four years (Y_4) will be \$5.

Out of all the proceeds, 50\% can be saved towards the year-end trip, as the other 50\% is spent on the various costs to run the brunch. Given the following input data, calculate whether or not the council will need to raise additional funds.

Input Specification

The input will contain 10 trips, at 3 lines of data per trip.

  • For each of the trips, the first line will show the cost of the trip as an integer (\$50 to \$50\,000).
  • The next line contains four floating point numbers Y_1, Y_2, Y_3, Y_4 (0 \le Y_1, Y_2, Y_3, Y_4 \le 1 and Y_1 + Y_2 + Y_3 + Y_4 = 1) representing the percentages of the total number of students from years 1 through 4 respectively.
  • The third line contains a single number N, which contains the total number of students attending the brunch (4 \le N \le 2000).

Note: You cannot have less than a whole person (e.g., 1.8 people is the same as 1 person). Any missing or extra people should be removed from or added to the group with the highest percentage of attendees. There will always be exactly one group with the highest percentage of attendees.

Output Specification

Output YES if the student council needs to find other funding, and NO if the council has raised sufficient funds.

Sample Input

0.5 0.2 0.1 0.2
0.1 0.1 0.45 0.35

Sample Output


Note: Only 2 cases are shown in this sample.

Educational Computing Organization of Ontario - statements, test data and other materials can be found at


There are no comments at the moment.