Briefcases Full of Money
Time limit1sMemory limit1024 MB
Given the bill counts for six denominations, print the denomination of the briefcase with the largest total, breaking ties by choosing the one with fewest bills.
- Level
Easy1 of 10
- Topics
- Implementation
- Solved
- No attempts yet
Problem
It is your birthday party and the six UCF programming team coaches arrive, each holding a briefcase containing money (a gift) for you. The coaches planned to give you all six briefcases, but Dr. "O" points out that the team needs money to travel to the World Contest Finals. So you get to choose one briefcase. You do not get all of them (sorry).
Each briefcase contains a stack of bills of one denomination: $1, $5, $10, $20, $50, or $100. The first briefcase has only $1 bills, the second only $5 bills, the third only $10 bills, the fourth only $20 bills, the fifth only $50 bills, and the sixth only $100 bills. You want the briefcase with the highest total amount.
You could pick one at random, but you trust your coding skills more than chance, so you write a program to pick the briefcase with the highest amount.
Input
There is one input line with six integers, each between 1 and 1000 inclusive. They are the numbers of $1, $5, $10, $20, $50, and $100 bills, in that order.
Output
Print the denomination of the briefcase to choose (1, 5, 10, 20, 50, or 100). If two or more briefcases have the highest total, print the one with the fewest bills, since that one is lighter.
Hint
Explanation of the second sample input and output: three briefcases ($1, $10, and $50) have the highest total ($200), so the answer is the briefcase with the fewest bills.