Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please make sure to provide the correct output for all ten test cases. ECOO '15 R1 P1 - When You Eat Your Smarties & view
Please make sure to provide the correct output for all ten test cases.
ECOO '15 R1 P1 - When You Eat Your Smarties \& view as PDF When I eat my Smarties I always eat the red ones last. I separate them into their color groups and I start by eating the orange ones, then blue, green, yellow, pink, violet, brown and finally red. The red ones are the best, so l eat them slowly one at a time. The other colors I eat quickly by the handful (my hand can hold a maximum of 7 Smarties). I always finish all the Smarties of one color before I move on to the next, so sometimes the last handful of a color isn't a full one. But wait, there's more! I have turned my Smartie-eating into a science. I know it always takes me exactly 13 seconds to eat a handful of non-red Smarties and I adjust my chewing rate so that I always take 13 seconds even if my hand is not completely full. When I eat the red Smarties I like to take my time, so it takes me exactly 16 seconds to eat each one. I have a big box of Smarties. After I've finished sorting the colors, how long will it take me to eat them? The input will contain 10 test cases. Each test case will start with N lines (50N200), where each line holds the color of a single Smartie in lower case. Then the last line will read meaning there are no more Smarties in the box for that test case. Your program should output a single line for each test case indicating how long (in seconds) it will take me to eat the entire box according to the rules given above. Note that the sample input below only contains 1 test case, but the real data files will contain 10 . Sample Input red brown brown violet blue pink blue blue pink brown yellow brown pink violet green yellow red orange orange blue brown pink red red red brown orange orange green red orange violet blue pink yellow pink brown orange green red blue yellow green orange brown orange pink violet brown red end of box Note: Only 1 case is shown in this sampleStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started