Programming/Python & Data Structures
[Baekjoon/Python3] 4153번 직각삼각형
HooNeee
2020. 12. 4. 17:27
[Baekjoon/Python3] 4153번 직각삼각형
4153번: 직각삼각형
입력은 여러개의 테스트케이스로 주어지며 마지막줄에는 0 0 0이 입력된다. 각 테스트케이스는 모두 30,000보다 작은 양의 정수로 주어지며, 각 입력은 변의 길이를 의미한다.
www.acmicpc.net
# ** 연산자 사용시
while True:
nums = list(map(int, input().split()))
if 0 in nums:
break
else:
nums.sort()
if nums[2] ** 2 == nums[0] ** 2 + nums[1] ** 2:
print('right')
else:
print('wrong')
# pow() 함수 사용시
while True:
nums = list(map(int, input().split()))
if 0 in nums:
break
else:
nums.sort()
if pow(nums[2], 2) == pow(nums[0], 2) + pow(nums[1], 2):
print('right')
else:
print('wrong')