[백준/파이썬] 15178번 풀이
업데이트:
문제 정보
- 문제 출처: 백준 온라인 저지
- 문제 링크: 15178번 문제
- 문제풀이 코드 GitHub 링크
- 제출 언어: Python 3
풀이
문제
Angela is teaching her primary school pupils how to use a protractor (which hopefully you know is a device used to measure angles!). She has given each pupil a set of triangles and asked them to measure and record each of the three internal angles.
Angela would like you to write a simple program to check her pupil s results. Knowing that the internal angles of a triangle add up to 180º, which results should Angela check?
입력 요약
You will be given a set of results from one class. It will start with a single integer, N, the number of pupils who have supplied readings. (0 < N <= 30). There will then follow N lines, each containing 3 positive integers separated by spaces. …
출력 요약
For each set of readings, output the numbers as input followed by the word Check if they do not add up to 180, or Seems OK if they do.
코드
for T in range(int(input())):
a,b,c=map(int,input().split())
print(a,b,c,'Check'if a+b+c!=180 else'Seems OK')
설명
핵심은 구현 관점에서 Angela is teaching her primary school pupils how to use a protractor (which hopefully you know is a device used to measure angles!). …를 만족하도록 로직을 구성하는 것입니다.
코드는 입력을 파싱한 뒤 조건 분기와 계산을 순서대로 수행하고, 문제에서 요구한 형식으로 결과를 출력합니다.
경계값과 예외 케이스도 함께 고려해 오답이 나기 쉬운 상황을 방지합니다.
댓글남기기