# CLUSCL - Editorial

Author and Editorialist: Soumik Sarkar
Tester: Sarthak Manna

SIMPLE

Basic maths

# PROBLEM:

A 12 hour clock runs at K times the rate of a correct clock. If initially at the start of day 1 it shows the correct time find the day on which it shows the correct time for the N^{th} time.

# EXPLANATION:

Let’s call the correct clock A and the useless one B. Let the time taken for one cycle of A be designated as unit time. Let \omega denote angular velocity is cycles per unit time, \theta denote angular displacement in cycles, and t denote time passed. We can say that

\begin{aligned} \omega_A &= 1 \\ \omega_B &= K \\ \theta_A &= \omega_A t\\ \theta_B &= \omega_B t\\ \end{aligned}

There are two cases to consider.

### Case K < 1:

As mentioned in the problem both A and B start off together. B runs slower than A, so it will show the correct time again when it is exactly one cycle behind the A. If this time is t, then

\begin{aligned} \theta_B &= \theta_A - 1 \\ \implies \omega_B t &= \omega_A t -1 \\ \implies K t &= t -1 \\ \implies t &= \frac{1}{1 - K} \\ \end{aligned}

### Case K > 1:

For this scenario, the times coincide for the first time after start when B is exactly one cycle ahead of A.

\begin{aligned} \theta_B &= \theta_A + 1 \\ \implies \omega_B t &= \omega_A t + 1 \\ \implies K t &= t + 1 \\ \implies t &= \frac{1}{K - 1} \\ \end{aligned}

For both cases, the clocks will continue to match again after every t time. To find the N^{th} instance we just need to calculate t \times N.

Now one cycle of 12 hours, or half a day, was designated as unit time. So we must multiply t \times N by 1/2 to get the time in days. Taking the floor of this value will give required number of the day.

Note that it is necessary to manipulate the values as fractions because the inherent error in floating point calculations can result in a wrong answer.

# AUTHOR’S AND TESTER’S SOLUTION:

Author’s solution can be found here
Tester’s solution can be found here.

3 Likes