题目链接:http://acm.split.hdu.edu.cn/showPRoblem.php?pid=2076
题解详见代码, 代码如下:
#include<stdio.h>void f(double m,double n){ double temp=m-n; if(temp<0) temp=-temp;//取绝对值 if(temp>180) temp=360-temp; //取小于180的角 printf("%d/n",(int)temp);}int main(){ int t; double a,b,c; double m,n; scanf("%d",&t); while(t--) { m=n=0; scanf("%lf%lf%lf",&a,&b,&c); if(a>12) //将24小时制,转换为12小时制 a=a-12.0; n+=b+c/60.0; m+=a+n/60.0; n*=6.0; m*=30.0;// printf("***%llf %llf/n",m,n); f(m,n); } return 0;}
新闻热点
疑难解答