- #include <iostream>
- #include <cstdio>
- #include <iomanip>
- #include <algorithm>
- using namespace std;
- int main(){
- double h, m, ht, mt, angle, div, te1, te2, mp1, temp1, temp2;
- while(scanf("%lf:%lf", &h, &m) == 2){
- if(h == 0 && h == m)break;
- div = (5*m)/60;
- ht = (h*5) + div; mt = m;
- te1 = max(ht, mt);
- te2 = min(ht, mt);
- mp1 = 60 - te1;
- temp1 = (mp1 + te2)*6;
- temp2 = (te1 - te2)*6;
- if(temp1 < 0)temp1 *= -1;
- if(temp2 < 0)temp2 *= -1;
- angle = min(temp1, temp2);
- while(angle > 180)angle -= 180;
- cout << fixed << setprecision(3) << angle << endl;
- }
- return 0;
- }
Friday, April 24, 2015
UVa - 579 - Clock Hands
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment