Banner Home Page DIY Contests Problems Ranklist Status Statistics
pdf版的题目下载:初赛goo.gl/rfbDY,决赛goo.gl/fNcyY。K题请使用GUN C++提交,用VC/VC++提交会返回RE。

Justice Time

Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 377   Accepted Submission(s) : 87

Font: Times New Roman | Verdana | Georgia

Font Size:

Problem Description

Snow is asleep if and only if Snow is attending a lecture. This is a well-known formula
among Snow's colleagues.
On a Wednesday afternoon, Snow was attending Professor HH's lecture. At 12:21, right
before falling asleep, she was staring at the digital watch around Saher's wrist. She noticed that the
digits on the clock were the same when read from both directions. She thinks such time is justice
in a day.
In her sleep, she started dreaming about such justice time of one day when the time displayed
on a digital clock is a palindrome. As soon as she woke up, she felt destined to write a program
that finds the next such moment.
However, she still hasn't mastered the skill of programming while sleeping, so your task is to
help her.

Input

The first line of the input contains an integer T (1<=T<=100) which means the number of test
cases. Then T lines follow, each line 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.

Output

For each test case, you should output two lines. The first line is "Case #:", # means the
number of the test case.
The second line contains a justice time of day that comes soonest after the time given in the
input. Output a blank line between two cases. There are no empty line In the last sample.

Sample Input

12:21
23:59

Sample Output

Case 1:
13:31

Case 2:
00:00

Author

AndRing

Source

2012年华南师范大学校赛初赛

Statistic | Submit | Back