Skip to content
CCC Python Course

Formula-plus-condition problems (J1 pattern)

Stage
3
Module
M3.1
Lessons
1

In this module

  • Turn a problem's written rule into a single arithmetic formula.
  • Branch on the formula's result with if/elif/else, choosing the right comparison at each boundary.
  • Print exactly the text a problem asks for, with no extra words or punctuation.

Before this module

Lessons

  1. 1Formula-plus-condition problems (J1 pattern)

Practice

Try these on the judges. Each link opens the problem on WMOJ or DMOJ.

  1. 2022 J1
    Cupcake Party (opens on WMOJ in a new tab) WMOJ

    Work out a fair price for a shared batch of cupcakes.

  2. 2021 J1
    Boiling Water (opens on WMOJ in a new tab) WMOJ

    Decide how long a kettle needs before water is ready.

  3. 2014 J1
    Triangle Times (opens on DMOJ in a new tab) DMOJ

    Classify a triangle as acute, right, or obtuse from its three angles.

    Why DMOJ: One of the earliest J1 problems, and still a plain formula-then-branch shape.