CCC '22 J1 - Cupcake Party

View as PDF

Submit solution


Points: 3
Time limit: 1.0s
Memory limit: 1G

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

A regular box of cupcakes holds 8 cupcakes, while a small box holds 3 cupcakes. There are 28 students in a class and a total of at least 28 cupcakes. Your job is to determine how many cupcakes will be left over if each student gets one cupcake.

Input Specification

The input consists of two lines.

  • The first line contains an integer R \ge 0, representing the number of regular boxes.
  • The second line contains an integer S \ge 0, representing the number of small boxes.

Output Specification

Output the number of cupcakes that are left over.

Sample Input 1

2
5

Output for Sample Input 1

3

Explanation of Output for Sample Input 1

The total number of cupcakes is 2 \times 8 + 5 \times 3 which equals 31. Since there are 28 students, there are 3 cupcakes left over.

Sample Input 2

2
4

Output for Sample Input 2

0

Explanation of Output for Sample Input 2

The total number of cupcakes is 2 \times 8 + 4 \times 3 which equals 28. Since there are 28 students, there are no cupcakes left over.


Comments


  • -4
    nadim2034  commented on Nov. 12, 2024, 8:11 p.m. edited
    user_input = input()
    user_list = user_input.split(" ")
    r = int(user_list[0])
    s = int(user_list[1])
    total_cupcakes = r * 8 + s * 3
    remaining_cupcakes = total_cupcakes - 28
    print(remaining_cupcakes)
    

    • -1
      Viv_CCGS  commented on Nov. 12, 2024, 11:27 p.m.

      Please refrain from posting solutions in the comments. It ruins the problem for the users who do want to solve the problem by themselves.


  • -16
    CCCCODER  commented on June 13, 2024, 8:10 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.