题意:
求分钟和时钟之间的夹角
解法:俩个夹角互减
AC:10ms
#include#include #include #include #include using namespace std;int main(){ while (true) { int h, m; scanf("%d:%d", &h, &m); if(h == 0 && m == 0) return 0; double mm = m * 6; //为什么是0.5 (m*6)*(1/12) //1/12,分钟走360度,时钟走30度 double hh = h * 30 + m * 0.5; double d = hh - mm; if(d < 0) { d = d + 360; } if(d > 180) { d = 360 - d; } printf("%.3f\n", d); } return 0;}
posted on 2017-05-20 10:08 阅读( ...) 评论( ...)