Facebook
From Александра, 3 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 51
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     string time;
  8.     cin >> time;
  9.     int h = (time[0] - '0') * 10 + (time[1] - '0');
  10.     int m = (time[3] - '0') * 10 + time[4] - '0';
  11.     h %= 12;
  12.     double ans = (h * 60 + m) * 0.5 - m * 6;
  13.     if (ans < 0) ans = -ans;
  14.     ans = min(ans, 360 - ans);
  15.     cout << ans;
  16.     return 0;
  17. }
  18.