## CCC '06 J1 - Canadian Calorie Counting

View as PDF

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type
##### Canadian Computing Competition: 2006 Stage 1, Junior #1

At Chip's Fast Food emporium there is a very simple menu. Each food item is selected by entering a digit choice.

 Here are the three burger choices: 1 – Cheeseburger (461 Calories) 2 – Fish Burger (431 Calories) 3 – Veggie Burger (420 Calories) 4 – no burger Here are the three drink choices: 1 – Soft Drink (130 Calories) 2 – Orange Juice (160 Calories) 3 – Milk (118 Calories) 4 – no drink Here are the three side order choices: 1 – Fries (100 Calories) 2 – Baked Potato (57 Calories) 3 – Chef Salad (70 Calories) 4 – no side order Here are the three dessert choices: 1 – Apple Pie (167 Calories) 2 – Sundae (266 Calories) 3 – Fruit Cup (75 Calories) 4 – no dessert

Write a program that will compute the total Calories of a meal.

#### Input Specification

The program should input a number for each type of item then calculate and display the Calorie total. The first line will be the customer's choice of burger, the second will be the choice of side, then drink, then dessert. You may assume that each input will be a number from 1 to 4. That is, each customer has to pick exactly one number from each of the four options out of each of the four categories.

#### Output Specification

The program prints out the total Calories of the selected meal, and stops executing after this output.

#### Sample Input

2
1
3
4

#### Sample Output

Your total Calorie count is 649.

#### Explanation

The customer chose Burger #2, Side #1, Drink #3 and Dessert #4.

CCC problem statements in large part from the PEG OJ

• commented on Sept. 8, 2021, 6:43 a.m.

Listen to this man the sample input is 2 1 3 4 which means the value of each of these decisions is 431 130 70 0 this comes out to 631. So 631 calories but the sample output says its 649 which couldnt be whenever i input my code i pass some of the test cases but not all of them so ive been sitting on this for a while, and maybe im just dumb, but i its doesnt look like anything is wrong with my code. any suggestions anybody (especially those who solved the problem)

• commented on Oct. 12, 2021, 6:29 a.m.

taking 2 3 1 4 gives 649

• commented on Sept. 8, 2021, 11:35 a.m.

You have the inputs in the wrong order. Reread the input specification section.

• commented on Sept. 3, 2021, 10:05 a.m.

I have another dumb question. Is there a way to see what the site uses in the test cases. For example when you get a problem wrong is it possible to see that data so that you can figure out what you're doing wrong?

• commented on Sept. 3, 2021, 12:22 p.m.

For some problems (like this one), once you get a testcase wrong there is a ">" sign before it. If you click on it, you can see what your program outputted. As for your code, everything is correct except that you weren't printing out the period.

• commented on Nov. 30, 2020, 3:13 p.m.

Can someone see why did I failed Test Case 2?

• commented on Nov. 30, 2020, 11:28 p.m.

• commented on Aug. 12, 2020, 4:12 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on Aug. 12, 2020, 6:24 p.m.

Firstly, you should avoid posting code in the comments: this is unnecessary clutter as anyone who has solved the problem can view your code, and also potential spoilers for those who want to solve the problems.

As for why your code doesn't work, double-check the whitespace of your output.

• commented on Aug. 7, 2020, 4:14 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on May 26, 2020, 2:50 p.m. edit 3

I'm the wonderful stupid idiot who made 16 if statements only to realize that I was being stupid. Also, isn't the sample output supposed to be 631 cals? Maybe my calculator is broken so please don't come at meh. Maybe that's why I got everything wrong.

• commented on Dec. 26, 2020, 5:17 p.m. edited

how can you avoid not having 16 if statements???

• commented on Sept. 3, 2021, 10:03 a.m.

Sorry to bug you. I'm learning Python and the book I'm using uses these tests. Up this point in the book we have covered if statements. I'm curious how you'd handle this without 16 if statements? What did I miss?? Thanks in advance.

• commented on Sept. 8, 2021, 9:38 p.m.

Before you read this comment this talks about ArrayLists! So the basic code I used was 4 if loops to check if it was a burger, side, drink, or dessert. Then I had 4 ArrayLists consisting of the costs of each item. Then you can take in your input(2 1 3 4). The first number stands for burger. I would use the line "cost += burgers.get(2-1)". This line means that the you are adding the cost with the ArrayList burgers. Then you use the get() function to get a specific number from the ArrayList for this example 2-1. You may ask why not 2? Its because you want the second item from your ArrayList and the index for the second item is 1 not 2. So you would put in 2-1. I hope this helps!!!!

• commented on March 1, 2021, 12:23 p.m. edit 2

Python Dictionary

Actually just use related lists marshmellon and sugarface are right

• commented on April 25, 2021, 3:20 p.m.

Or just related lists

• commented on June 19, 2020, 7:29 p.m. edited

Someone else posted this original comment. It is now removed.

• commented on May 26, 2020, 7:53 p.m.

If you read the input specifications, they give you the input for for a side first, then a drink, not the other way around. Hope that fixes your problem :)

• commented on Aug. 4, 2019, 8:17 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on Dec. 4, 2018, 10:56 p.m.

I forgot the period!!!!!!

• commented on Aug. 26, 2018, 1:37 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on May 26, 2020, 2:55 p.m. edited

• commented on Dec. 28, 2019, 10:41 p.m.

Note the word

Veggie Burger

A burger has 295 calories (according to Google). A sundae has 180 calories (according to Google).

It seems as if the calories were more/less doubled.

• commented on July 21, 2018, 4:51 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on July 17, 2021, 10:53 p.m.

The out put is not wrong

• commented on July 27, 2021, 5:11 a.m.

How come? because clearly the 4th option for any of the choices is 0?

• commented on June 19, 2020, 7:20 p.m. edit 2

Someone else posted this original comment. It is now removed.

• commented on Aug. 2, 2018, 12:23 p.m. edit 2

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on Dec. 1, 2020, 12:15 a.m.

Lost a ton of brain cells reading that :O

• commented on June 19, 2020, 7:16 p.m. edited

Someone else posted this original comment. It is now removed.

• commented on Dec. 1, 2020, 12:18 a.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on Feb. 24, 2020, 7:14 p.m.

God reading that hurt my brain

• commented on July 21, 2018, 9:04 p.m.

So you're telling me around 270 people got AC while the output is wrong? [explain your logic here]

• commented on Nov. 19, 2017, 8:41 a.m.

Rather than asking for help in comments, which severely clutters up the comments stream, you can go to https://slack.dmoj.ca and ask for help in the #help channel. You will be able to get quicker responses and better explanations.