http://acm.hdu.edu.cn/showproblem.php?pid=1209

水题,按五个时针分针成的锐角从小到大排序,角度相同时间从早到晚,输出中间的那个

时针一小时走30度,一分钟走0.5度,分针一分钟走6度,注意是锐角,大于180要用360减回去,为避免精度出问题统一乘2拒绝小数

#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std; struct node {
int hh, mm;
int ang;
}kk[]; int ABS(int x) {
return x > ? x : -x;
} int cmp(node a, node b) {
if(a.ang == b.ang) return a.hh * + a.mm < b.hh * + b.mm;
return a.ang < b.ang;
} int main() {
int T;
scanf("%d", &T);
while(T--) {
for(int i = ; i < ; i++) {
scanf("%d:%d", &kk[i].hh, &kk[i].mm);
kk[i].ang = ABS(kk[i].hh % * + kk[i].mm - kk[i].mm * );
if(kk[i].ang > ) kk[i].ang = - kk[i].ang;
}
sort(kk, kk + , cmp);
printf("%02d:%02d\n", kk[].hh, kk[].mm);
}
return ;
}

HDU 1209的更多相关文章

  1. hdu 1209 Clock(排序)

    题意:按钟表的时针.分针的夹角对5个时间进行升序排序,输出第3个时间 思路:排序 注意:若夹角相同,则按时间进行升序排序 #include<iostream> #include<st ...

  2. hdu 1209 Clock

    Clock Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submi ...

  3. HDU——PKU题目分类

    HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...

  4. [转] HDU 题目分类

    转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...

  5. HDU ACM 题目分类

    模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...

  6. HDU 5643 King's Game 打表

    King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...

  7. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

  8. hdu 分类

    HDU分类 http://www.cnblogs.com/ACMan/archive/2012/05/26/2519550.html#2667329 努力A完.方便自己系统A题 不断更新中...... ...

  9. Ural 1209. 1, 10, 100, 1000... 一道有趣的题

    1209. 1, 10, 100, 1000... Time limit: 1.0 secondMemory limit: 64 MB Let's consider an infinite seque ...

随机推荐

  1. 参考:(Java Selenium)Element is not visible to clcik

    1.The element is not visible to click. Use Actions or JavascriptExecutor for making it to click. By ...

  2. Zabbix 3.0.3 SQL Injection

    Zabbix version 3.0.3 suffers from a remote SQL injection vulnerability. ============================ ...

  3. C++11带来的优雅语法

    C++11带来的优雅语法 自动类型推导 auto auto的自动类型推导,用于从初始化表达式中推断出变量的数据类型.通过auto的自动类型推导,可以简化我们的编程工作; auto是在编译时对变量进行了 ...

  4. wampserver You don't have permission to access / on this server. 解决 方法(转,正好碰到这样的事情了就转下来)

    最近在安装最近版wampserver 2.2 d时发现安装好后启动服务器,访问localhost显示You don't have permission to access / on this serv ...

  5. requestAnimationFrame 动画

    requestAnimationFrame : 调用这个方法,就是告诉浏览器要执行动画了,从而浏览器自动计算动画时间间隔,从而在恰当的时候刷新UI, 动画更加平滑. 他的用法和setTimeout() ...

  6. json对象,数组,字符串总结

    关于json对象,数组,字符串的总结 什么是json? JSON(JavaScript Object Notation)  一种轻量级的数据交换格式,JSON采用完全独立于语言的文本格式...(来自百 ...

  7. 6/13 Sprint2 看板和燃尽图

    部分页面展示

  8. jquery打字机效果

    html代码 <div id="box"> <div id="content"> <div id="code" ...

  9. Selenium操作页面元素

    转自:http://blog.sina.com.cn/s/blog_6966650401012a7q.html 一.输入框(text field or textarea) //找到输入框元素: Web ...

  10. [Android] Web Console: Uncaught TypeError: Object [object Object] has no method 'xxx'

    我们开发的产品,有一部分功能,需要在WebView中打开web页面,然后在web页面中通过js方法回调部分native的功能. 对于web回调native的开发方式,如果不了解的话,可以参考我以前的一 ...