luogu#P7060. [NWRRC2014] Alarm Clock

[NWRRC2014] Alarm Clock

题目描述

Alice likes her digital alarm clock. She sets them up every evening. Last night Alice had a dream about her clock. Unfortunately, the only thing she is able to remember is the number of highlighted segments of the clock. Alice wonders what time was set on the clock in her dream.

Alice's clock have four digits: two for hours and two for minutes. For example, the clock below shows 9:309:30 (note the leading zero).

The clock uses following digit representation.

输入格式

The only line of the input file contains single integer nn — the number of highlighted segments of the clock in Alice's dream (0n30)(0 \le n \le 30) .

输出格式

Output five characters in hh:mm\text{hh:mm} format — the time shown on the clock in Alice's dream. The time must be correct: 0hh<240 \le \text{hh} < 24 and 0mm<600 \le \text{mm} < 60 . If there are many possible correct times, output any of them. If there is none, output Impossible.

题目大意

Alice梦见了一个时间,但她只记得了这个时间在电子钟上显现出来的段数,现在给出这个段数,让你反推Alice梦见的时间(若有多个答案,输出任意一个均可)
段数:想必大家都听说过用火柴拼数字的游戏,比如1要用两个火柴,2要用5根火柴,8要用7根火柴等等(如题目图片所示),这里的段数指的就是一个时间的每一个数字,需要火柴数量的和(比如09:30,就要6+6+5+6=23个火柴)。
时间:本题输出的时间仅有小时和分钟,其中小时在0到23之间,分钟在0到59之间

输入一个整数n,n在0到30以内,代表Alice梦见的段数
输出一个字符串,如果有合法的时间满足输入的段数,则输出这个时间(有多个输出任意一个均可),否则输出Impossible

注意时间的前导零

23

09:30

28

Impossible

2

Impossible

提示

Time limit: 2 s, Memory limit: 256 MB.

spj provider:

user/237530