Created
July 13, 2021 08:11
-
-
Save uchidama/fd03d06c1c3fb9dd2f71dd20b26b4160 to your computer and use it in GitHub Desktop.
AtCoder Beginner Contest 168 [ C - : (Colon) ] https://atcoder.jp/contests/abc168/tasks/abc168_c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
[問題] | |
https://atcoder.jp/contests/abc168/tasks/abc168_c | |
''' | |
import sys | |
import math | |
sys.setrecursionlimit(10 ** 6) # 再帰上限の引き上げ | |
input = sys.stdin.readline | |
INF = 2 ** 63 - 1 | |
A, B, H, M = map(int, input().split()) | |
# 時針の位置 | |
h_shita = (H * 60 + M)/(12 * 60) | |
h_x = A * math.cos(2 * math.pi * h_shita) | |
h_y = A * math.sin(2 * math.pi * h_shita) | |
# 分針の位置 | |
m_shita = M/60 | |
m_x = B * math.cos(2 * math.pi * m_shita) | |
m_y = B * math.sin(2 * math.pi * m_shita) | |
# 距離の計算 | |
ans = math.sqrt( (h_x - m_x) ** 2 + (h_y - m_y) ** 2) | |
print(ans) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment