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. HTML 事件属性(下)

    HTML 事件属性(下) 一:键盘事件 (Keyboard Events)二:鼠标事件 (Mouse Events) 一:键盘事件 (Keyboard Events)在下列元素中无效:base.bdo ...

  2. Mysql常用数据类型

    Mysql常用数据类型 数字: 字符串: 时间:

  3. XML学习笔记(四)-- 修饰XML文档的CSS

    标签(空格分隔): 学习笔记 XML为存储结构化数据提供了强大的方法,但是它没有提供关于数据如何显示地信息,(数据的结构与数据表示无关).可以使用CSS来控制XML文档中各元素的呈现方式. CSS语法 ...

  4. CSSOM之getComputedStyle,currentStyle,getPropertyValue,getAttribute

    js关于CSSOM编程的样式相关几个常用的方法 webkit:getComputedStyle,getPropertyValue IE:currentStyle,getAttribute 前言 jqu ...

  5. CSS小三角制作

    以下是参考资料: 好多种图形的:http://www.jb51.net/css/41448.html -------------------------------------15.11.12---- ...

  6. Deep Learning 8_深度学习UFLDL教程:Stacked Autocoders and Implement deep networks for digit classification_Exercise(斯坦福大学深度学习教程)

    前言 1.理论知识:UFLDL教程.Deep learning:十六(deep networks) 2.实验环境:win7, matlab2015b,16G内存,2T硬盘 3.实验内容:Exercis ...

  7. 使用Eclipse创建maven项目

    前提:Eclipse中安装了maven插件,或者Eclipse版本在Mars以上(自集成maven) 1.new project --maven project 2.默认点击next 3.选择构建类型 ...

  8. oracle连接本地数据库

    连接方式: 通过SQL Developer进行连接: 通过sql plus 进行连接: SQL Developer进行连接1.安装Oracle 11g会自带一个叫做SQL Developer的工具,它 ...

  9. iOS 启动图那些坑

    当我们按照图片尺寸要求将所有的图片添加到工程中后,上传打包的工程时可能会出现一个问题:说工程中不存在启动图.但是我们明明已经导入启动图了,那么问题出在哪呢.我经过多次试验,发现压缩过后的图片作为启动图 ...

  10. c c++怎么判断一个字符串中是否含有汉字

    c c++怎么判断一个字符串中是否含有汉字 (2013-02-05 10:44:23) 转载▼     #include  #include  int main() { char sztext[] = ...