天天看點

HDU 5276 YJC tricks time

Problem Description

YJC received a mysterious present. It's a clock and it looks like this. 

YJC is not a timelord so he can't trick time but the clock is so hard to read. So he'd like to trick you.

Now YJC gives you the angle between the hour hand and the minute hand, you'll tell him what time it is now.

You'll give him the possible time in the format:

HH:MM:SS

HH represents hour, MM represents minute, SS represents second.

(For example, 

08:30:20)

We use twelve hour system, which means the time range is from 

00:00:00 to 

11:59:59.

Also, YJC doesn't want to be too accurate, one answer is considered acceptable if and only if SS mod 10 = 0 .

Input

1000 cases in one test.

for each case:

One integer 

x indicating the angle, for convenience, 

x has been multiplied by 

12000. (So you can read it as integer not float) In this case we use degree as the unit of the angle, and it's an inferior angle. Therefore, 

x will not exceed 

12000∗180=2160000.

Output

For each case:

T lines. 

T represents the total number of answers of this case.

Output the possible answers in ascending order. (If you cannot find a legal answer, don't output anything in this case)

Sample Input

99000

Sample Output

00:01:30

11:58:30

00:00:00

暴力模拟

#include<cstdio>
#include<iostream>
#include<queue>
#include<vector>
#include<map>
#include<cmath>
#include<algorithm>
using namespace std;
const int maxn = 100005;
int T, n, m;

int main()
{
    while (cin >> n)
    {
        for (int i = 0; i < 12;i++)
            for (int j = 0; j < 60;j++)
                for (int k = 0; k < 6; k++)
                {
                    int a = i * 3600 + j * 60 + k * 10, b = j * 60 + k * 10;
                    int c = max(a * 100 - b * 1200, b * 1200 - a * 100);
                    c = min(4320000 - c, c);
                    if (c == n) printf("%02d:%02d:%02d\n", i, j, k * 10);
                }
    }
    return 0;
}