leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1344.cpp (333B)


      1 class Solution {
      2   public:
      3     double angleClock(int hour, int minutes) {
      4         double m = (360.0 / 60.0 * minutes);
      5         double h = (360.0 / 12.0 * hour) + (30.0 / 60.0 * minutes);
      6         if (h >= 360) h -= 360;
      7         double res = max(m, h) - min(m, h);
      8         if (res >= 180) res = 360 - res;
      9         return res;
     10     }
     11 };