您的位置:首页 > 其它

hdu2076-夹角有多大(题目已修改,注意读题)

2013-05-22 21:47 218 查看
http://acm.hdu.edu.cn/showproblem.php?pid=2076

按照不同单位转一圈,然后转换成某一个统一的单位换算即可

#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "math.h"
#include "algorithm"
#include "iostream"

using namespace std;

int main()
{
int n , h , m , s ;
double ans1 , ans2 , temp ;
scanf( "%d" , &n ) ;
int t ;
while( n-- )
{
scanf( "%d%d%d" ,&h , &m , &s ) ;
ans1 = 1.0 * m * 6 + 0.1 * s ;
ans2 = 1.0 * ( h % 12 ) * 30 + 0.5 * m + 1.0 / 120 * s ;
temp = fabs( ans1 - ans2 ) ;
if( temp > 180 )
t = (int )(360 - temp) ;
else
t = (int)temp ;
printf( "%d\n" ,t );
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  杭电