El campanar de la Torrassa strikes back P98577


Statement
 

pdf   zip

thehtml

[r]

El campanar de la Torrassa is well known for annoying its neighbors with the sound of its bells. Recently, the priest of this church has decided to collect money to buy a new iron bell for the bell tower. He plans to sound it every time the clock’s hands overlap. For instance, the bell will sound at 12:00 and at around 13:05. According to the priest, this new way of playing the bells will double the number of faithful (which should be easy because his church is usually almost empty).

Before authorizing this innovation, the bishopric wants to know the number of times that the bell will sound during a large amount of time. Specifically, given a starting time (h:m) and a length in minutes ℓ, how many times will the bell sound during this period of time?

Input

Input consists of several cases, each one with three integer numbers h, m and ℓ. Assume 0 ≤ h ≤ 23, 0 ≤ m ≤ 59, and 0 ≤ ℓ ≤ 230.

Output

For every case, print the number of times that the new bell will sound starting at (h:m) for a length of ℓ minutes. Take into account that, because of a small delay, the bell will sound twenty-four miliseconds after the clock’s hands have actually overlapped.

Public test cases
  • Input

    11 59 0
    11 59 1
    11 59 2
    11 59 10
    11 59 90
    12 0 0
    12 0 1
    11 0 1
    

    Output

    0
    0
    1
    1
    2
    0
    1
    0
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C++ Python