暴力 BestCoder Round #46 1001 YJC tricks time

 

题目传送门

 1 /*
 2     暴力:模拟枚举每一个时间的度数
 3     详细解释:http://blog.csdn.net/enjoying_science/article/details/46759085
 4     期末考结束第一题,看看题解找找感觉:)
 5 */
 6 #include <cstdio>
 7 #include <algorithm>
 8 #include <cstring>
 9 #include <vector>
10 #include <iostream>
11 using namespace std;
12 
13 typedef long long ll;
14 const int MAXN = 1e3 + 10;
15 const int INF = 0x3f3f3f3f;
16 
17 int main(void)        //BestCoder Round #46 1001 YJC tricks time
18 {
19     // freopen ("A.in", "r", stdin);
20 
21     int n;
22     while (scanf ("%d", &n) == 1)
23     {
24         for (int i=0; i<=11; ++i)
25         {
26             for (int j=0; j<=59; ++j)
27             {
28                 for (int k=0; k<=50; k+=10)
29                 {
30                     ll di = (i * 3600 + j * 60 + k) * 100;    //不是很懂
31                     ll dj = (j * 60 + k) * 1200;
32                     ll t = abs (di - dj);
33                     if (t > 2160000)    t = 4320000 - t;    //劣角
34                     if (t == n)
35                     {
36                         printf ("%02d:%02d:%02d\n", i, j, k);
37                     }
38                 }
39             }
40         }
41     }
42 
43     return 0;
44 }

 

posted @ 2015-07-06 13:38  Running_Time  阅读(169)  评论(0编辑  收藏  举报