Algorithm Study/Python

[백준 파이썬] # 4153 직각삼각형

728x90
반응형

Bronze III

# 4153 직각삼각형

링크 : https://www.acmicpc.net/problem/4513

 

4513번: The Neptune Adventure

For each data set in the input, print a single line with the shortest amount of time in minutes it takes to reach the location of the rescue team from your starting location without drowning (if possible). If it is not possible to reach the location of the

www.acmicpc.net

 

풀이

while True:
    li = list(map(int, input().split()))
    if li[0]==li[1]==li[2]==0:
        break
    li = sorted(li)
    if li[0]**2 + li[1]**2 == li[2]**2:
        print('right')
    else:
        print('wrong')

 

후기

  • sorted를 통해 입력값 중 가장 큰 값을 li[2]에 위치할 수 있도록 구분한다.