试题编号: | 201903-2 |
试题名称: | 二十四点 |
时间限制: | 1.0s |
内存限制: | 512.0MB |
问题描述: | |
满分代码
"""
10
9+3+4x3
5+4x5x5
7-9-9+8
5x6/5x4
3+5+7+9
1x1+9-9
1x9-5/9
8/5+6x9
6x7-3x6
6x4+4/5
"""
n = int(input().strip())
result = []
for i in range(n):
temp = input().strip()
temp = temp.replace("/","//") # 将/替换为//
temp = temp.replace("x",'*') # 将x替换为*
if eval(temp) == 24:
result.append("Yes")
else:
result.append("No")
print("\n".join(result))