BOJ - 13420 - 사칙연산
Updated:
import sys
def solution():
T = int(sys.stdin.readline())
for i in range(T):
calculator = list(map(str, sys.stdin.readline().split()))
if calculator[1] == '*':
if int(calculator[4]) == int(calculator[0]) * int(calculator[2]): print("correct")
else: print("wrong answer")
elif calculator[1] == '+':
if int(calculator[4]) == int(calculator[0]) + int(calculator[2]): print("correct")
else: print("wrong answer")
elif calculator[1] == '-':
if int(calculator[4]) == int(calculator[0]) - int(calculator[2]): print("correct")
else: print("wrong answer")
elif calculator[1] == '/':
if int(calculator[4]) == int(calculator[0]) // int(calculator[2]): print("correct")
else: print("wrong answer")
solution()
https://www.acmicpc.net/problem/13420
Leave a comment