题目:http://ac.jobdu.com/problem.php?pid=1553
/*
分别算出时针和分针的度数,做差之后分几种情况讨论,(-360,-180),[-180,0),[0,180],(180,360).
*/
#include <stdio.h>
int main(){
int h,m;
while (~scanf("%d:%d",&h,&m)) {
double hd,md,mdd;
hd = (h%12)*30;
md = m*6;
mdd = ((double)m)/2;
double temp = hd + mdd - md;
//printf("%.2lf %.2lf %.2lf %.2lf\n",hd,md,mdd,temp);
if(temp > 180)
printf("%.2lf\n",360 - temp);
else if (temp < 0 && (temp > -180 || temp == -180) )
printf("%.2lf\n",-temp);
else if(temp < -180)
printf("%.2lf\n",360 + temp);
else
printf("%.2lf\n",temp);
}
return 0;
}