// UVa 579 - Clock Hands
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main() {
string l;
getline(cin, l);
while (l.length() != 4 || l[0] != '0' || l[2] != '0' || l[3] != '0') {
int h = (l[0] - '0');
if (l[1] != ':')
h = h * 10 + (l[1] - '0');
int m = (l[l.length() - 1] - '0') + (l[l.length() - 2] - '0') * 10;
double am = (m * 360.0 / 60.0);
double ah = (m / 60.0 + h) / 12.0 * 360.0;
double mx = max(am, ah);
double mn = min(am, ah);
double wise = mx - mn;
double counter = mn + 360 - mx;
double sol = min(wise, counter);
printf("%.3f\n", sol);
getline(cin, l);
}
return 0;
}
Wednesday, June 10, 2015
UVa 579 - Clock Hands
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment