School Trip

View as PDF

Submit solution

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

Author:
Problem type

Problem taken from DMOJ.

BOSS is planning a year-end trip for the graduating class. However, they need to find a way to raise money to fund the trip, as it costs C dollars. They eventually settle on organizing a school lunch, where students can buy a lunch in the cafeteria for some amount of money.

The members of BOSS decide that the price of the lunch depends on how many years a student has been at the school. For students who have been at the school for one year, the price will be $12. For students that have been at the school for two years, the price will be $10. For students that have been at the school for three years, the price will be $7. For students that have been at the school for four years, the price will be $5.

Only half of the proceeds from this event can be saved for the year-end trip, since the other half is spent on the cost to run the event.

Given the following data, calculate whether the profits are sufficient for the trip or if more money is required.

Input Specification

The first line will be the integer cost of the trip C(50 \le C \le 10000).

The next line contains four space-separated floating point numbers Y_1, Y_2, Y_3, Y_4(0 \le Y_1, Y_2, Y_3,Y_4 \le 1 , Y_1 + Y_2 + Y_3 + Y_4 = 1), which represents the percentage of students who have been at the school for Y_x years (Y_1 is one year, Y_2 is two years, etc.).

The third line is the number of students attending the lunch event N(4 \le N \le 2000).

Note: Number of students for each year should be rounded down. For example, if there are 20.7 first-year students who bought a lunch, the number should be rounded down to 20. Any remaining students not accounted for should be added to the group with the highest percentage of people.

Output Specification

Output YES if BOSS needs more money for the trip, or NO if they raised enough money.

Sample Input 1

4000
0.5 0.2 0.1 0.2
400

Sample Output 1

YES

Sample Input 2

6000
0.1 0.1 0.45 0.35
2000

Sample Output 2

NO

Comments

There are no comments at the moment.