python-algorithm

백준 10698 Ahmed Aly

무적김두칠 2022. 12. 28. 16:29

https://www.acmicpc.net/problem/10698

 

10698번: Ahmed Aly

Your program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 ≤ T ≤ 100). Followed by T lines, each test case is a single line containing an equation in the following format

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
def sol(s):
    left, right = s.split('=')
    if eval(left)==int(right):
        return 'YES'
    else:
        return 'NO'
 
 
if __name__ == '__main__':
    n = int(input())
    for i in range(1,n+1):
        s = input()
        s = s.replace(' ','')
        print('Case %d: %s'%(i, sol(s)))
cs
반응형