hdu 2076 夹角有多大

简介:
#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;
}
目录
相关文章
|
机器学习/深度学习
HDOJ(HDU) 2524 矩形A + B(推导公式、)
HDOJ(HDU) 2524 矩形A + B(推导公式、)
76 0
HDOJ(HDU) 2524 矩形A + B(推导公式、)
|
Java
HDU 2080 夹角有多大II
夹角有多大II Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10901    Accepted Submission(s): 5642 Problem Description 这次xhd面临的问题是这样的:在一个平面内有两个点,求两个点分别和原点的连线的夹角的大小。
930 0
数论 + 公式 - HDU 4335 What is N?
What is N?  Problem's Link:  http://acm.hdu.edu.cn/showproblem.php?pid=4335   Mean:  给你三个数b、P、M,让你求有多少个n满足下式。
833 0
[LintCode] 最多有多少个点在一条直线上
1 /** 2 * Definition for a point. 3 * struct Point { 4 * int x; 5 * int y; 6 * Point() : x(0), y(0) {} 7 * Point(...
903 0
|
机器学习/深度学习
|
机器学习/深度学习 BI