现在的位置: 首页 > 综合 > 正文

hdu2076(时针和分针的夹角)

2019年02月21日 ⁄ 综合 ⁄ 共 280字 ⁄ 字号 评论关闭

#include<stdio.h>
#include<math.h>
int main ()
{
    int t,s,m,h,y;
    double f;
    scanf ("%d",&t);
    while (t--)
    {
        scanf ("%d%d%d",&h,&m,&s);
        h=h%12;
       f=fabs((h+m/60.0+s/3600.0)*5*6-(m+s/60.0)*6);
        printf ("%d\n",f>180?(int)(360-f):(int)f);//这样小数点后的数不会进位
    }
    return 0;
}

抱歉!评论已关闭.