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;
}
按照不同单位转一圈,然后转换成某一个统一的单位换算即可
#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;
}
相关文章推荐
- hdu2076夹角有多大(题目已修改,注意读题)
- HDU2076 夹角有多大(题目已修改,注意读题) 【数学题】
- HDU2076 夹角有多大(题目已修改,注意读题)【水题】【计算几何】
- hdu2076 夹角有多大(题目已修改,注意读题)(C语言)
- HDU 2076 夹角有多大(题目已修改,注意读题)
- HDU 2076 夹角有多大(题目已修改,注意读题)
- HDU 2076 夹角有多大(题目已修改,注意读题)
- HDU 2076 夹角有多大(题目已修改,注意读题)
- A - 夹角有多大(题目已修改,注意读题) HDU
- 单位nullhdu2076-夹角有多大(题目已修改,注意读题)
- hdu 2076夹角有多大(题目已修改,注意读题)
- HDU 2076 夹角有多大(题目已修改,注意读题)
- HDOJ2076 夹角有多大(题目已修改,注意读题)
- hdoj.2076 夹角有多大(题目已修改,注意读题) 20140801
- hdu 2076 夹角有多大(题目已修改,注意读题)
- Q - 夹角有多大(题目已修改,注意读题)
- hdu 2076 夹角有多大(题目已修改,注意读题)
- hdu-2076-夹角有多大(题目已修改,注意读题)
- *寒假水57——夹角有多大(题目已修改,注意读题)
- C - 夹角有多大(题目已修改,注意读题)