Clock Math - Easy Problems - Solution to Toph.co Online Judge Problem

Clock Math

Limits 1s, 512 MB

Given a time (hours as H and minutes as M), determine the smaller angle between the two hands of a clock showing the time and print it.

Input

The input will contain two integers: H (0 ≤ H < 12) and M (0 ≤ M < 60).

Output

Print the angle in degrees (accurate to 10-4).

#include<stdio.h>

int main()
{
    double hour,min,angle;
    scanf("%lf%lf",&hour,&min);
    angle=0.5*(60*hour-11*min);
    if(angle>180)
        angle=360-angle;
    printf("%.7lf\n",angle);
}