HDU 1209
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的更多相关文章
- hdu 1209 Clock(排序)
题意:按钟表的时针.分针的夹角对5个时间进行升序排序,输出第3个时间 思路:排序 注意:若夹角相同,则按时间进行升序排序 #include<iostream> #include<st ...
- hdu 1209 Clock
Clock Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submi ...
- HDU——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
- [转] HDU 题目分类
转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...
- HDU ACM 题目分类
模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...
- HDU 5643 King's Game 打表
King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...
- 转载:hdu 题目分类 (侵删)
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...
- hdu 分类
HDU分类 http://www.cnblogs.com/ACMan/archive/2012/05/26/2519550.html#2667329 努力A完.方便自己系统A题 不断更新中...... ...
- 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 ...
随机推荐
- 17.KVM安装之虚拟磁盘,安装脚本
1.创建磁盘 vm.list 指定虚拟磁盘名称和主机名 create_vm.sh #创建vm.list中的虚拟磁盘,并指定大小100G #!/bin/bash VM_DIR="/opt ...
- Open source packages on Deep Reinforcement Learning
智能车 self driving car + 强化学习 reinforcement learning + 神经网络 模拟 https://github.com/MorvanZhou/my_resear ...
- 怎样去除ul li a标签文字下的下划线
这个主要是text-decoration属性,颜色的话就是普通的了 <style> ul li a{ text-decoration:none; } ul li a { color: ...
- PHP文本框的值随下拉框改变
初学PHP,下面是实现文本框内容随下拉框变化的代码实现: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN&q ...
- InnoDB和MyISAM(转)
两种类型最主要的差别就是Innodb 支持事务处理与外键和行级锁.而MyISAM不支持. 我作为使用MySQL的用户角度出发,Innodb和MyISAM都是比较喜欢的,但是从我目前运维的数据库平台要达 ...
- win7文件夹图标中多了一把小锁打不开文件夹怎么办?
win7文件夹图标中多了一把小锁打不开文件夹怎么办?解决办法一:右击目录→取得管理员权限!该方法适用于win7旗舰版.解决办法二:右击目录→属性→安全→高级→选择everyone→更改权限→勾上完全访 ...
- Security » Authorization » 基于自定义策略的授权
Custom Policy-Based Authorization¶ 基于自定义策略的授权 98 of 108 people found this helpful Underneath the cov ...
- Linux 指令
cat cdchmod chowncp cut 名称:cat使用权限:所有使用者使用方式:cat [-AbeEnstTuv] [--help] [--version] fileName说明:把档案串连 ...
- Modify textures at runtime
动态修改Texture Modify textures at runtime?http://answers.unity3d.com/questions/7906/modify-textures-at- ...
- Probit回归模型
Probit模型也是一种广义的线性模型,当因变量为分类变量时,有四种常用的分析模型: 1.线性概率模型(LPM)2.Logistic模型3.Probit模型4.对数线性模型 和Logistic回归一样 ...