728x90
풀이
식과 답이 주어졌을 때, 식의 결과가 주어진 답과 일치하는지 판별하면 되는 문제다.
식에는 항상 두 수와 하나의 부호가 주어지기 때문에 문자열 분리를 통해 결과를 얻을 수 있지만,
Python에서는 string을 입력받아 실행시키는 eval func를 지원하기 때문에 간단히 풀이할 수 있다.
소스코드
출처
26531번: Simple Sum
You have hired someone to help you with inventory on the farm. Unfortunately, the new cowhand has very limited math skills, and they are having trouble summing two numbers. Write a program to determine if the cowhand is adding these numbers correctly.
www.acmicpc.net
728x90
'PS > Baekjoon Online Judge' 카테고리의 다른 글
[백준 26530] Shipping [Python] (0) | 2023.06.04 |
---|---|
[백준 9471] 피사노 주기 [C] (0) | 2023.06.02 |
[백준 26532] Acres [Python] (0) | 2023.06.02 |
[백준 26546] Reverse [Python] (0) | 2023.05.31 |
[백준 27590] Sun and Moon [Python] (0) | 2023.05.30 |