Problem: Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively.  An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.  At 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?

Submission attempts (in order):
# C
import math

A,B,H,M = map(int,input().split(' '))

rad = math.radians(abs(H*30-M*6))

print('{:.15f}'.format((A**2 + B**2 - 2*A*B*math.cos(rad))**0.5))

# C
import math

A,B,H,M = map(int,input().split(' '))


rad = abs(H*30-M*6)
rad = math.radians(min(rad,360-rad))
print('{:.15f}'.format((A**2 + B**2 - 2*A*B*math.cos(rad))**0.5))

import math

A,B,H,M = map(int,input().split(' '))


if H >= 6:
    edge = abs(M*6+(12-H)*5*6)
else:
    edge = abs(M*6-H*5*6)

if edge > 180:
    edge = 360 - edge
print(edge)
if edge%180 == 0:
    print('{:.15f}'.format(A+B))
else:
    print('{:.15f}'.format(math.sqrt(A*A + B*B - 2*A*B*math.cos(math.radians(edge)))))

# C
import math

A,B,H,M = map(int,input().split(' '))


rad = abs(H/6*math.pi-M/30*math.pi)
rad = min(rad,360-rad)
print('{:.15f}'.format(A*A + B*B - 2*A*B*math.cos(rad))**0.5)

import math

A,B,H,M = map(int,input().split(' '))

if H >= 6:
    edge = abs(M*6+(12-H)*5*6)
else:
    edge = abs(M*6-H*5*6)

if edge > 180:
    edge = 360 - edge
print(edge)
if edge%180 == 0:
    print('{:.15f}'.format(A+B))
else:
    print('{:.15f}'.format(math.sqrt(A*A + B*B - 2*A*B*math.cos(math.radians(edge)))))

import math

A,B,H,M = map(int,input().split(' '))


if H >= 6:
    edge = abs(M*6+(12-H)*5*6)
else:
    edge = abs(M*6-H*5*6)

if edge > 180:
    edge = 360 - edge
print(edge)
if edge%180 == 0:
    print('{:.20f}'.format(A+B))
else:
    print('{:.20f}'.format(math.sqrt(A*A + B*B - 2*A*B*math.cos(math.radians(edge)))))

import math

A,B,H,M = map(int,input().split(' '))


if H >= 6:
    edge = abs(M*6+(12-H)*5*6)
else:
    edge = abs(M*6-H*5*6)

if edge > 180:
    edge = 360 - edge

if edge%180 == 0:
    print('{:.15f}'.format(A+B))
else:
    print('{:.15f}'.format(math.sqrt(A*A + B*B - 2*A*B*math.cos(math.radians(edge)))))

import math

A,B,H,M = map(int,input().split(' '))


if H >= 6:
    edge = abs(M*6+(12-H)*5*6)
else:
    edge = abs(M*6-H*5*6)

if edge > 180:
    edge = 360 - edge

if edge%180 == 0:
    print('{:.15f}'.format(A+B))
else:
    print('{:.15f}'.format(math.sqrt(A*A + B*B - 2*A*B*math.cos(edge))))

import math

A,B,H,M = map(int,input().split(' '))


rad = abs(H/6*math.pi-M/30*math.pi)
    
print('{:.15f}'.format(math.sqrt(A*A + B*B - 2*A*B*math.cos(rad))))

import math

A,B,H,M = map(int,input().split(' '))


if H >= 6:
    edge = abs(M*6+(12-H)*5*6)
else:
    edge = abs(M*6-H*5*6)

if edge > 180:
    edge = 360 - edge

if edge%180 == 0:
    print('{:.15f}'.format(A+B))
else:
    print('{:.15f}'.format(math.sqrt(A*A + B*B - 2*A*B*math.cos(math.radians(edge)))))

# C
import math

A,B,H,M = map(int,input().split(' '))
rad = abs((H*30+M/2)-M*6)
rad = math.radians(min(rad,360-rad))
print('{:.20f}'.format((A**2 + B**2 - 2*A*B*math.cos(rad))**0.5))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted