CSPC '15 #5 - Averages

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

The Coyote is currently taking N courses and wants to be able to quickly calculate his averages. Since the Coyote's main goal is to get a 95\% overall average, he's decided to drop a course.

He wants to know how his new average will change depending on which course he decides to drop. He also wants to know which course he should drop to get closer to his goal.

Your task is to write a program that reads his courses and associated averages, then calculates his average before he drops his selected course, his average after he drops the course, and finally which course he should drop to get as high an average as he can.

Input Specification

The first line of input will consist of the single integer N (1 \le N \le 100).
The next N lines will contain course information. The i^\text{th} line will contain the name of the i^\text{th} course followed by a single space followed by the Coyote's mark c_i in the course in % format (i.e. 90%).
The next line will contain the name of the course the Coyote wants to drop.

Output Specification

The first line of output should contain the Coyote's average prior to dropping a course, rounded to two decimal places and in % format.
The next line of output should contain his average after dropping a course, in % format and rounded to two decimal places.
The next line of output should contain the name of the course he should drop to have the largest positive increase in his mark. If there are two courses with the same lowest mark, output the first one that is inputted as the recommended course to drop.
The next line of output should contain his average if he drops the optimal course.
If his average after dropping the optimal course is over 95\%, output You have reached your goal. Otherwise, output You are N% away from your goal., where N represents the difference between your goal and your average after you drop the optimal course. If N is a decimal, always round DOWN, i.e. 27.6\% \to 27\%.

Sample Input

6
Math 95%
Physics 85%
English 80%
Chemistry 90%
TechDesign 90%
ComputerSciences 95%
Physics

Sample Output

89.17%
90.00%
English
91.00%
You are 4% away from your goal.

Comments

There are no comments at the moment.