Sunday, February 27, 2011

579 - ClockHands


#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
    unsigned long int H,M;
    float ang,h;
    freopen("in.txt","r",stdin);
    while(1)
    {
        scanf("%ld:%ld",&H,&M);
        if(!(H+M))break;
        h=(H*60+M)/2.0;
        M*=6;
        ang=(h>M)?h-M:M-h;
        if(ang>180)ang=360-ang;
        printf("%0.3f\n",ang);
    }
    exit(0);
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.