leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
1344.cpp (333B)
0 class Solution {
1 public:
2 double angleClock(int hour, int minutes) {
3 double m = (360.0 / 60.0 * minutes);
4 double h = (360.0 / 12.0 * hour) + (30.0 / 60.0 * minutes);
5 if (h >= 360) h -= 360;
6 double res = max(m, h) - min(m, h);
7 if (res >= 180) res = 360 - res;
8 return res;
9 }
10 };