此题是一道数学题
思路比较简单,就是考虑的时候想全面了就ok了!呵呵!
首先理解30度/1h=0.5度/1min=(1/120)/1s,理解这个比例关系,此外
注意:1)判断一下h的大小,如果大于12小时,令h=h-12;
      2)在计算完角度的时候,判断一下角度的大小如果大于180度,令“角度=360-角度”;
**祝你成功AC!呵呵!!
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
 int T,h,m,s,b;
 double a;
 cin>>T;
 getchar();
 while(T--)
 {
       cin>>h>>m>>s;
    h=h>12?(h-12):h;
       a=fabs(m*6+s*0.1-(h*30+m*0.5+s*1.0/120));
    b=(int)(a>180?(360-a):a);
    printf("%d\n",b);
 }
     return 0;
    }

相关文章:

  • 2021-06-26
  • 2021-06-01
  • 2021-07-23
  • 2021-10-24
  • 2021-04-11
  • 2021-04-06
  • 2021-04-17
  • 2021-11-16
猜你喜欢
  • 2022-12-23
  • 2021-08-06
  • 2021-11-07
  • 2021-08-04
  • 2021-08-16
  • 2021-04-16
  • 2021-04-26
相关资源
相似解决方案