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 ...
随机推荐
- 用jxl解析excel内容
需要导入jxl.jar 下方表格为excel中内容: 序号 姓名 性别 生日 地址 1 测试1 男 1990-1-1 北京朝阳区 2 测试2 女 1998-2-2 北京海淀 3 测试3 男 1999- ...
- Visual Studio的Web Performance Test提取规则详解(3)
总结 Visual Studio的Web Performance Test是基于HTTP协议层的,它不依赖于浏览器,通过直接接收,发送HTTP包来和Web服务器交互.Web Performance T ...
- [问题2014S05] 复旦高等代数II(13级)每周一题(第五教学周)
[问题2014S05] 设 \(A,B\) 分别是 \(4\times 3\) 和 \(3\times 4\) 实矩阵, \[ BA=\begin{pmatrix}-9 & -20 & ...
- 制作登录界面,登录成功后把用户名放在session里,在第3个页面读取session显示用户名
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- (原创)LAMP搭建之二:apache配置文件详解(中英文对照版)
LAMP搭建之二:apache配置文件详解(中英文对照版) # This is the main Apache server configuration file. It contains the # ...
- [http session]
原文链接:http://lavasoft.blog.51cto.com/62575/275589/ 1.Session创建的时间是: 一个常见的误解是以为session在有客户端访问时就被创建,然而事 ...
- 转:C语言 可变参数
C语言 可变参数 堆栈一般是怎么压栈处理的 /* * stack space: * * 参数3 | up * 参数2 | * 参数1 v ...
- Oracle存储过程-自定义数据类型,集合,遍历取值
摘要 Oracle存储过程,自定义数据类型,集合,遍历取值 目录[-] 0.前言 1.Packages 2.Packages bodies 3.输出结果 0.前言 在Oracle的存储过程中,可能会遇 ...
- 用单分子测序(single-molecule sequencing)和局部敏感哈希(locality-sensitive hashing)来组装大型基因组
Assembling large genomes with single-molecule sequencing and locality-sensitive hashing 好好读读,算法系列的好文 ...
- android定义启动唯一apk
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="ht ...