codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

108A.md (1384B)


      1 Source: https://codeforces.com/problemset/problem/108/A
      2 
      3 A. Palindromic Times
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Tattah is asleep if and only if Tattah is attending a lecture. This is a well-known formula among Tattah's colleagues.
     22 
     23 On a Wednesday afternoon, Tattah was attending Professor HH's lecture. At 12:21, right before falling asleep, he was staring at the digital watch around Saher's wrist. He noticed that the digits on the clock were the same when read from both directions i.e. a palindrome.
     24 
     25 In his sleep, he started dreaming about such rare moments of the day when the time displayed on a digital clock is a palindrome. As soon as he woke up, he felt destined to write a program that finds the next such moment.
     26 
     27 However, he still hasn't mastered the skill of programming while sleeping, so your task is to help him.
     28 
     29 Input
     30 
     31 The first and only line of the input starts with a string with the format "HH:MM" where "HH" is from "00" to "23" and "MM" is from "00" to "59". Both "HH" and "MM" have exactly two digits.
     32 
     33 Output
     34 
     35 Print the palindromic time of day that comes soonest after the time given in the input. If the input time is palindromic, output the soonest palindromic time after the input time.
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 12:21
     43 ```
     44 
     45 Output
     46 
     47 ```
     48 13:31
     49 ```
     50 
     51 Input
     52 
     53 ```
     54 23:59
     55 ```
     56 
     57 Output
     58 
     59 ```
     60 00:00
     61 ```