#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int cmp(const void *a,const void *b)
{
return *(double* )a > *(double *)b ?1 :-1;
}
double fun(int x,int y)
{
if(x>12)

x=x-12;

return abs(x*30-(y/5.0)*30)> 180 ? 360-abs(x*30-(y/5.0)*30):abs(x*30-(y/5.0)*30);
}
struct node
{
double a;
int b;
}c[10];

int main( )
{
int N;
scanf("%d",&N);
while(N--)
{
int i,j,h[10],m[10];
memset(h,0,sizeof(h));
memset(m,0,sizeof(m));

for(i=0;i<5;i++)
{
c[i].a=0;
c[i].b=0;
}
for(i=0;i<5;i++)
scanf("%d:%d",&h[i],&m[i]);

for(i=0;i<5;i++)
{
c[i].a=fun(h[i],m[i]);

c[i].b=i;

}
qsort(c,5,sizeof(c[0]),cmp);

printf(h[c[2].b]<10?"0%d:":"%d:",h[c[2].b]);
printf(m[c[2].b]<10?"0%d\n":"%d\n",m[c[2].b]);

}
//system("pause");
return 0;
}

正确代码:
正确代码:
正确代码:

转载于:https://www.cnblogs.com/tangcong/archive/2011/04/10/2011829.html

hdu 1209 clocks wrong answer 我的错误代码(没审好题唉,角度一样后,还要按小时排序。...相关推荐

  1. hdu - 4027 Can you answer these queries?

    http://acm.hdu.edu.cn/showproblem.php?pid=4027 /** * 题意:给你n个数,对这些数进行操作,有m组操作 * q == 0 [x,y]区间内的每个数开方 ...

  2. HDU 4027 Can you answer these queries?(线段树/区间不等更新)

    传送门 Can you answer these queries? Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65768/6576 ...

  3. hdu 4027 Can you answer these queries?

    http://acm.hdu.edu.cn/showproblem.php?pid=4027 [更新区间,查询区间]的线段树,必须抓住修改6次以后每个数必然会变成1,然后以后的修改都将不起作用,在此之 ...

  4. HDU - 4027 Can you answer these queries?(线段树)

    题目链接:点击查看 题目大意:给定n艘敌军的舰队,每艘舰队都有一定的耐力值,随后进行m次操作,共包括两种操作,分别是输出区间[l,r]中的耐力 值之和,以及将区间[l,r]中的每个的耐力值都开平方 题 ...

  5. HDU 6445 Search for Answer(最小费用最大流-mcmf)

    Description 给出一个nnn个点的完全图的邻接矩阵aaa,其中ai,j=1a_{i,j}=1ai,j​=1表示i,ji,ji,j之间边的方向是iii到jjj,ai,j=0a_{i,j}=0a ...

  6. 【HDU - 5477】A Sweet Journey(思维,水题)

    题干: Master Di plans to take his girlfriend for a travel by bike. Their journey, which can be seen as ...

  7. *【HDU - 2586】How far away ? (LCA模板题,倍增)

    题干: There are n houses in the village and some bidirectional roads connecting them. Every day peole ...

  8. HDU 4422 The Little Girl who Picks Mushrooms(简单题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4422 题目大意:小姑娘背着5个包去山上采蘑菇,每座山上只能用一个背包采集.三个小精灵会要她3个背包,其 ...

  9. HDU 4283:You Are the One 区间DP好题

    String painter 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4283 题意: 有n个人参加选秀,每个人有一个Di值,Di值*(出场时间 ...

最新文章

  1. 51单片机学习笔记(郭天祥版)(4)——练习、动态扫描、练习、数码管消影...
  2. SAP 不同 ABAP 系统里同一 Customizing activity 的显示差异分析
  3. 微信公众号回调java_处理微信公众号消息回调
  4. Django学习手册 - ORM 数据创建/表操作 汇总
  5. [Linux C]重启设备(系统)
  6. 精通Windows Sockets 网络开发-基于Visual C++实现
  7. Entity Framework使用Sqlite时的一些配置
  8. Oracle 视图、序列、索引、游标、触发器、事务
  9. 【优化求解】基于matlab蚁群算法求解函数极值问题【含Matlab源码 1201期】
  10. AT绑定句柄无效和拒绝访问
  11. day21、3 - 防火墙HA
  12. 加强化工企业危化品管理的几点建议
  13. Vue3中TSX和h函数的用法
  14. 如何快速地提高店铺销量
  15. android 震动的实现,android实现震动和声音
  16. 换内存条的过程(自己电脑换的整个过程记录分享)
  17. 使用animate库
  18. CNN分类中批量读取数据及制作标签时报错:could not broadcast input array from shape (128,128,3) into shape (128,128)
  19. 前端表格插件Jquery DataTable简单汉化
  20. Vue(三)——过滤器,内置指令,自定义指令,组件

热门文章

  1. aspen plus v11使用教程_Aspen Plus11.0安装教程
  2. php fpm 平滑重启,nginx、php-fpm平滑重启和重载配置
  3. AT0 Intrudoction
  4. AI学习笔记(十二)物体检测(上)
  5. 各大厂商CTR广告预估模型的优缺点对比
  6. 支持向量机的基本思想_支持向量机理论详细推导
  7. pythondraw解释_科学网—Draw figures with Python - 高琳琳的博文
  8. html5 input选择文件,input文件选择,限定文件类型。
  9. 小k娱乐网php,zblog仿小k资源模板Zblogphp系统精仿小k资源网主题模板面世啦!特惠福利...
  10. long到number转换 ts_js如何将纯数字字符串转换为long型