Problem Description
Problem Analysis
A contest really does change everything about a person
The problem statement already gives the hint
The rotation is continuous, not discrete
So you need double to record the fractional parts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| #include<stdio.h>
#include<math.h>
int main() {
int T;
scanf("%d",&T);
while(T--) {
int h,m,s;
scanf("%d %d %d",&h,&m,&s);
h%=12;
double tm=s/10.0+m*6.0;
double th=h*30.0+tm/12.0;
double res=fabs(th-tm);
if(res>360-res)
res=360-res;
printf("%d\n",(int)res);
}
return 0;
}
|
Problem link:HDU 2076 How Big Is the Angle