cool hamsters never sleep

백준 4153. 직각삼각형 본문

Python Algorithm

백준 4153. 직각삼각형

슈슈 susu 2022. 8. 17. 20:27
while True :
  x, y, z = map(int, input().split())
  if x + y + z == 0 :
    break
  else :
    if pow(x,2) == pow(y,2) + pow(z,2) or pow(y,2) == pow(x,2) + pow(z,2) or pow(z,2) == pow(x,2) + pow(y,2) :
      print("right")
    else :
      print("wrong")

 

 

 

직각삼각형 공식 중 가장 긴 한 변의 제곱은 다른 두 변 각각의 제곱 합과 같다는 점에서 착안했습니다.

'Python Algorithm' 카테고리의 다른 글

백준 11651. 좌표 정렬하기 2  (0) 2022.08.19
백준 2447. 별 찍기 - 10  (0) 2022.08.18
백준 1085. 직사각형에서 탈출  (0) 2022.08.16
백준 2839. 설탕 배달  (0) 2022.08.15
백준 10814. 나이순 정렬  (0) 2022.08.14
Comments