TCCC '23 Sept P5- Da Perfect Burger

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
PyPy 3 2.0s
Memory limit: 64M

Author:
Problem type

Thornhill Computer Club 2023 - September Contest - Problem 5

Going to Da Perfect Burger🥰

After a letter of recomendation from JoePeewee, your family has become addicted to the wonderful, fulfilling, family friendly, out of this world experience that has been eating at Da Perfect Burger.

The great news of Da Perfect Burger's existence was too much for a few people to handle, and so the name of Da Perfect Burger restaurant quickly spread among the rest of your extended family. Intrigued by the promise of meaty and delicious goodness, all 1962345 relatives of yours have come to your house to complete their pilgrimage. Being the only one in your extended family with legs, they have given you all of their savings for you to purchase Da Perfect Burger feast on their behalf.

The feast will consist of 4 food items: burgers, hotdogs, fries, and milkshakes.

  • Burgers are $5
  • Hotdogs are $4
  • Fries are $112
  • Milkshakes are $2.

Importantly, each food item has a separate budget. Money given for a food type may only be used to buy that food type.

When taking orders from your family, you are given $6 for every burger, $5 for every hotdog, and $115 for every set of fries.

After spending as much money as possible in each given category of food, the remaining money is then pooled together into the milkshake fund.

Your family knows that you are given more money than what is actually needed, so you are able to purchase a milkshake with the left over money after maximizing the number of burger, hotdogs, and fries purchased.

At Da Perfect Burger, there is a one milkshake per person policy. Fortunately, the sizes of milkshakes are infinite.

The base milkshake can be purchased for $2 dollars. For $2 more dollars you can upgrade your shake into a super shake. An additional $2 dollars can upgrade your super shake into a duper shake. Another $2 more gets you a omega shake. Afterwards, $2 more dollars gives you an omega super shake, then an omega duper shake, then an omega omega shake, and so on and so on. You of course want to buy the largest milkshake you can spending all the leftover money.

After completing your order, what is the last prefix on the milkshake you purchased with the leftover burger, hotdog, and fries money?

Input Specification

The first line will contain an integer N (1 \le N \le 1000) representing the number of food items that need to be purchased. The next N lines will contain either BURGER, HOTDOG, or FRIES representing the food item to purchase.

Output Specification

A string of either SUPER, DUPER, OMEGA, representing the final prefix of the milkshake purchased. or NO PREFIX if you only afford the base milkshake.

Note: it will always be possible to purchase at least the base milkshake.

Sample Input 1

3
BURGER
HOTDOG
FRIES

Sample Output 1

SUPER

Explanation for Sample Output 1

After taking orders from your family, you will be left with $6 for burgers, $5 for hotdogs, and $115 for fries.
Using this money, you would be able to purchase, 1 burger, 1 hotdog, and one set of fries, the maximum amount for each category.
The remaining money would amount to $5, ($1 of burger money + $1 of hotdog money + $3 of fries money) The leftover money can get a super milkshake ($2 for the base milkshake + $2 for the super upgrade).

Sample Input 2

8
BURGER
BURGER
BURGER
BURGER
BURGER
BURGER
BURGER
BURGER

Sample Output 2

NO PREFIX

Explanation for Sample Output 2

After taking orders from your family, you will be left with $48 of burger money.
This can be used to purchase 9 burgers, the maximum amount possible.
You can only purchase a regular milkshake with the remaining money $3.


Comments

There are no comments at the moment.