YOGADAY - Editorial

PROBLEM LINK:

Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4

Author: notsoloud
Tester: airths
Editorialist: iceknight1093

DIFFICULTY:

TBD

PREREQUISITES:

None

PROBLEM:

Surya Namaskar is a series of 12 yoga poses.
Chef performed N yoga poses. How many Surya Namaskar rounds did he complete?

EXPLANATION:

Each time Chef reaches a pose number that’s a multiple of 12 (that is, 12, 24, 36, \ldots), he’ll have completed one more round of Surya Namaskar.
So, the answer is the number of multiples of 12 that are \leq N.

This can be computed as

\left\lfloor \frac{N}{12} \right\rfloor

where \left\lfloor \cdot \right\rfloor denotes the floor function.

Alternately, since N is so small, you can loop through multiples of 12 till you reach one that’s \gt N.

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Editorialist's code (Python)
n = int(input())
print(n//12)