ps | |
---|---|
링크 | acmicpc.net/… |
출처 | BOJ |
문제 번호 | 17236 |
문제명 | Heights |
레벨 | 골드 4 |
분류 |
기하학 |
시간복잡도 | O(1) |
사용한 언어 | Python 3.13 |
제출기록 | 34536KB / 36ms |
최고기록 | 36ms |
해결날짜 | 2025/02/24 |
"""Solution code for "BOJ 17236. Heights".
- Problem link: https://www.acmicpc.net/problem/17236
- Solution link: http://www.teferi.net/ps/problems/boj/17236
Tags: [geometry]
"""
from teflib import geometry
def main():
ha = float(input())
hb = float(input())
hc = float(input())
A, B, C = geometry.triangle_from_sides(hb * hc, hc * ha, ha * hb)
BC = (C[0] - B[0], C[1] - B[1])
area_t = geometry.twice_of_polygon_area([A, B, C]) / 2
ha_t = geometry.point_line_distance(*A, *B, *BC)
answer = area_t * (ha / ha_t) ** 2
print(answer)
if __name__ == '__main__':
main()
"""Solution code for "BOJ 17236. Heights".
- Problem link: https://www.acmicpc.net/problem/17236
- Solution link: http://www.teferi.net/ps/problems/boj/17236
Tags: [geometry]
"""
import math
def main():
ha = float(input())
hb = float(input())
hc = float(input())
a, b, c = hb * hc, hc * ha, ha * hb
s = (a + b + c) * 0.5
area_t = math.sqrt(s * (s - a) * (s - b) * (s - c))
ha_t = area_t * 2 / a
answer = area_t * (ha / ha_t) ** 2
print(answer)
if __name__ == '__main__':
main()