題目鏈接: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;}
新聞熱點
疑難解答