Cometin'

BOJ-4153 - Python

2021-06-17 at Algorithm category

3가지 정수를 입력받은 후 해당 길이로 이루어진 삼각형일 때, 직각 삼각형인 지 출력하는 문제. 세 수를 제곱한 값과 비교하여 풀었다.

import sys
input = sys.stdin.readline

while True:
    x, y, z = sorted(map(int, input().split()))
    if x == y == z == 0: break
    if x ** 2 + y ** 2 == z ** 2: print("right")
    else: print("wrong")

hyesungoh

Personal blog by hyesungoh.

I like to share my knowledge for those who wandering in issue.