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 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 . For students that have been at the school for two years, the price will be . For students that have been at the school for three years, the price will be . For students that have been at the school for four years, the price will be .
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 .
The next line contains four space-separated floating point numbers , which represents the percentage of students who have been at the school for years ( is one year, is two years, etc.).
The third line is the number of students attending the lunch event .
Note: Number of students for each year should be rounded down. For example, if there are first-year students who bought a lunch, the number should be rounded down to . 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