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
Practice
Try these on the judges. Each link opens the problem on WMOJ or DMOJ.
- 2022 J1Cupcake Party (opens on WMOJ in a new tab) WMOJ
Work out a fair price for a shared batch of cupcakes.
- 2021 J1Boiling Water (opens on WMOJ in a new tab) WMOJ
Decide how long a kettle needs before water is ready.
- 2014 J1Triangle 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.