码迷,mamicode.com
首页 > 其他好文 > 详细

hdu 2076 夹角有多大

时间:2015-05-28 21:38:24      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:hdu

#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
    int t,h,m,s;
    cin>>t;
    while(t--)
    {
        cin>>h>>m>>s;
        if(h>12) //注意还有h>24的时候
            h-=12;
        double ans=fabs((h*30+0.5*m+0.5/60*s)-(m*6+s*0.1));
        if(ans>180) //夹角不可能超过180°
            ans=360-ans;
        printf("%d\n",(int)ans);
    }
    return 0;
}

hdu 2076 夹角有多大

标签:hdu

原文地址:http://blog.csdn.net/qingshui23/article/details/46127405

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!