Question: C++ thanks Ms. McClean is extremely particular about keeping the house (especially the kitchen) clean - She is also extremely worried about missing items as

C++ thanks
Ms. McClean is extremely particular about keeping the house (especially the kitchen) clean - She is also extremely worried about missing items as well. She has engraved numbers in cereal bowls and keeps them in increasing order (#1 at the top, #2 right below, then #3, so on.) or decreasing order (# at the bottom, #2 right above it, then #3, so on.) She loads the dishwasher every night, cleans up & arranges everything back into the shelves perfectly every night. Now, she wonders how many times each bowl gets used, particularly since people always use the top available bowl! To even out the usage of bowls as much as possible, she comes up with an idea-she will reverse the order few days once! She does starts with increasing order of bowl #s for the first day. Also, after all the bowls get used, she forgets the previous day's status, so she arranges them in increasing order as well. Since she has a steady stream of visitors (children & grandchildren!) coming & staying for a few days (also, a few of them may not eat cereals in the morning), # of cereal bowls used every day can vary! Here is a sample input & output: 10 5 2 3 R2 31 2 210000 2 3 In this example, 10 specifies # of cereal bowls (numbered #1 to #10), next number 5 specifies the # of days we need to process. Next line has # of top cereal bowls used on each of those 5 days. Additionally, R also appears a few times indicating the order reversal of bowls. Final line is the output line that indicating # of each cereal bowl is used
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
