zoukankan      html  css  js  c++  java
  • 暴力 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
    ", i, j, k);
    37                     }
    38                 }
    39             }
    40         }
    41     }
    42 
    43     return 0;
    44 }
    编译人生,运行世界!
  • 相关阅读:
    SQL关闭连接,及分离数据库
    C# 用户选择单个压缩-系统自带压缩
    设计模式7大原则--01
    httpclient
    Mac idea 常用命令
    集合整理
    几种简单的排序算法
    基础数据结构简介
    git 常用命令3
    git 常用命令2
  • 原文地址:https://www.cnblogs.com/Running-Time/p/4624185.html
Copyright © 2011-2022 走看看