Algorithm/boj

[파이썬] 1069 집으로

takeU 2022. 6. 29. 13:14
반응형
x, y, d, t = map(int, input().split())

ans = distance = (x ** 2 + y ** 2) ** 0.5
q = distance // d
if distance >= d:
    ans = min(ans, q * t + distance % d, (q + 1) * t)
else:
    ans = min(ans, t + (d - distance), 2 * t)
print(ans)

기하