반응형
백준: 13985번 Equality (Python3)
Equality 성공다국어
시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 | 512 MB | 2050 | 1578 | 1454 | 77.464% |
문제
You are grading an arithmetic quiz. The quiz asks a student for the sum of the numbers. Determine if the student taking the quiz got the question correct.
입력
The first and the only line of input contains a string of the form:
a + b = c
It is guaranteed that a, b, and c are single-digit positive integers. The input line will have exactly 9 characters, formatted exactly as shown, with a single space separating each number and arithmetic operator.
출력
Print, on a single line, YES if the sum is correct; otherwise, print NO.
예제 입력 1
1 + 2 = 3
예제 출력 1
YES
예제 입력 2
2 + 2 = 5
예제 출력 2
NO
답안
1
2
|
formula = input()
print("YES" if (int(formula[0]) +int(formula[4])) == int(formula[-1]) else "NO")
|
cs |
반응형
'공부 > 코딩테스트' 카테고리의 다른 글
백준: 14065번 Gorivo (Python3) (0) | 2022.08.05 |
---|---|
백준: 14038번 Tournament Selection (Python3) (0) | 2022.08.05 |
백준: 13866번 팀 나누기 (Python3) (0) | 2022.08.05 |
백준: 13623번 Zero or One (Python3) (0) | 2022.08.05 |
백준: 13597번 Tri-du (Python3) (0) | 2022.08.05 |
댓글