UVa : 579 – Clock Hands


/*
User ID: turing_13
Link: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=520
*/

#include <stdio.h>
#include <math.h>

int main ()
{
    double time,angle,hour,min;
    char a;
    while(scanf("%lf %c %lf", &hour,&a,&min) != EOF)
    {
        if(hour==0.00 && min==0.00)
            break;
        angle=(min*6)-(hour*30)-(min/2);
        if(angle<0)
            angle=360+angle;
        if(angle>180)
            angle=360-angle;
        printf("%.3lf\n", angle);

    }
    return 0;
}


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s