# hoj 1010 The Angle

The interval angle between the hour hand and the minute hand is always among 0 degree and 180 degree(including 0 and 180 degree). For example, when it’s 12 o’clock, the angle of the two hands is 0 while 6:00 is 180 degree. Try to calculate any degree when it’s between 12:00 to 11:59.

Input
The input data are of various situations. Every team consists of two numbers : the first number stands for the hour(great than 0 and less than or equal to 12) and second represents the minute( among [0, 59]). The input ends when the two numbers are both zeros.
Output
Print out the minimum angle between the two hands with the normal time form outputed.
Input Sample

Output Sample

[cpp]
#include <stdio.h>
#include <math.h>
int main()
{
double mAngle,hAngle,a,b,begin;
int hour,minute;
while(scanf("%d %d",&hour,&minute)==2)
{
if((hour==0&&minute==0)||minute>59||hour>12)
break;
a=(double)minute/60; //a代表minute给hAngle所带来的增量
begin=(double)hour;
if(begin==12)
begin=0;
begin+=a;
hAngle=30*begin;
mAngle=(double)minute*360/60;
b=fabs(mAngle-hAngle);
if(b>180)
b=360-b;
printf("At %d:%02d the angle is %.1lf degrees.n",hour,minute,b);
}
return 0;
}
[/cpp]

## 《hoj 1010 The Angle》上有2条评论

1. （话说我留个英文名的话你知道我是谁吗→_→）Maggie

不水不水挺难的，为什么都是英文啊，你们的项目要求都是英文给的吗，写代码是在哪里写，真想见识一下

回复
1. kugwzk 文章作者

这不是项目啊，这些都是一些ACM的比赛题目而已。代码你点击那个expend source就可以看到了

回复