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. Android动画View Animation

    Animations 一.Animations介绍 Animations是一个实现android UI界面动画效果的API,Animations提供了一系列的动画效果,可以进行旋转.缩放.淡入淡出等, ...

  2. Double Buffering Windows Forms

    Double Buffering Windows Forms As much as we would like it not to be the case, graphics can be slow ...

  3. 离线安装Cloudera Manager 5和CDH5(最新版5.1.3) 完全教程

    关于CDH和Cloudera Manager CDH (Cloudera's Distribution, including Apache Hadoop),是Hadoop众多分支中的一种,由Cloud ...

  4. 用TCGA收集的mRNA表达数据作差异表达

    做差异表达的软件DEseq和edgeR所需要的数据格式必须是原始counts,经过normalization和log2后的数据都不适合,所以对于做差异表达计算的童鞋可以使用ExperimentHub下 ...

  5. win7 用户目录

    robocopy "C:\Users" "D:\Users" /E /COPYALL /XJ /XD "C:\Users\Administrator& ...

  6. 《BI那点儿事》数据流转换——模糊分组转换

    在模糊查找中我们提到脏数据是怎样进入到表中的事情,主要还是由于一些“Lazy-add”造成的.这种情况我们的肉眼很容易被欺骗,看上去是同一个单词,其实就差那么一个字母,变成了两个不同的单词.一个简单的 ...

  7. flex 4.6 移动开发 app.xml配置说明

    <?xml version="1.0" encoding="utf-8" standalone="no"?> <appli ...

  8. [部署]MVC4.0+EF5.0+ODT+ORACLE相关注意事项

    摘要 项目开发工具:VS2012旗舰版(.NetFrameWork4.5.1),WIN7 64bit,Oracle 11g 服务器环境:Windows Server2008 R2 64bit,.Net ...

  9. 【转】Linux下patch打补丁命令

    [转]Linux下patch打补丁命令 转自:http://www.cnblogs.com/noaming1900/archive/2010/10/28/1863282.html 此命令用于为特定软件 ...

  10. SpringMVC -- 梗概--贰

    1.为什么要配置: mvc:annotation-driven 1>在springMVC的处理流程中,有两个重要组件:HandlerMapping和HandlerAdapter 分别负责解析Ha ...