ZOJ Problem Set - 3782 python
2018-03-26 18:45
323 查看
Ternary CalculationTime Limit: 2 Seconds Memory Limit: 65536 KBComplete the ternary calculation.
list = []
while T:
T-=1
n = raw_input()
list.append(eval(n))
for i in range(P):
print(list[i])
Input
There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:There is a string in the form of "number1 operatora number2 operatorb number3". Each operator will be one of {'+', '-' , '*', '/', '%'}, and each number will be an integer in [1, 1000].Output
For each test case, output the answer.Sample Input
5 1 + 2 * 3 1 - 8 / 3 1 + 2 - 3 7 * 8 / 5 5 - 8 % 3
Sample Output
7 -1 0 113P=T = input()
list = []
while T:
T-=1
n = raw_input()
list.append(eval(n))
for i in range(P):
print(list[i])
相关文章推荐
- ZOJ Problem Set - 1002 Fire Net (Python)
- ZOJ Problem Set - 1201 Inversion (Python)
- ZOJ Problem Set - 3782 Ternary Calculation
- ZOJ Problem Set - 1392 The Hardest Problem Ever
- ZOJ Problem Set - 2176 Speed Limit
- ZOJ Problem Set–2201 No Brainer
- ZOJ Problem Set - 2412
- ZOJ Problem Set - 3673 1729
- ZOJ Problem Set - 1057||Undercut
- ZOJ Problem Set - 3603||Draw Something Cheat
- ZOJ Problem Set - 1049 I Think I Need a Houseboat
- ZOJ Problem Set - 1067
- ZOJ Problem Set - 1076 Gene Assembly
- ZOJ Problem Set - 1078(Palindrom Numbers)
- ZOJ Problem Set - 2750
- ZOJ Problem Set - 1093 Monkey and Banana
- ZOJ Problem Set - 1655
- ZOJ Problem Set - 1709 Oil Deposits
- ZOJ Problem Set - 3643 Keep Deleting
- ZOJ Problem Set - 3829Known Notation(贪心)