#P892. Favourite Times

    ID: 892 Type: Default 1000ms 64MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>2017BASICforif字串窮舉累加迴圈運算CCC

Favourite Times

題目描述

Wendy has an LED clock radio, which is a 12-hour clock, displaying times from 12:00 to 11:59. The hours do not have leading zeros but minutes may have leading zeros, such as 2:07 or 11:03.

When looking at her LED clock radio, Wendy likes to spot arithmetic sequences in the digits. For example, the times 12:34 and 2:46 are some of her favourite times, since the digits form an arithmetic sequence. A sequence of digits is an arithmetic sequence if each digit after the first digit is obtained by adding a constant common difference. For example, 1,2,3,4 is an arithmetic sequence with a common difference of 1, and 2,4,6 is an arithmetic sequence with a common difference of 2.

Suppose that we start looking at the clock at noon (that is, when it reads 12:00) and watch the clock for some number of minutes. How many instances are there such that the time displayed on the clock has the property that the digits form an arithmetic sequence?

輸入格式

The input contains one integer D (0 ≤ D ≤ 1 000 000 000), which represents the duration that the clock is observed. 

輸出格式

Output the number of times that the clock displays a time where the digits form an arithmetic sequence starting from noon (12:00) and ending after D minutes have passed, possibly including the ending time.

Samples

["34","180"]
["1","11"]

原始資料

  • Zero1 題號:a892
  • Hydro 題號:Z0892
  • Locale:zh_TW
  • Display:open