解题思路:
注意事项:
参考代码:
import re
sm=0
try:
while True:
s = input()
if len(s) == 0:
break
n = re.split("[-+=]", s)
# print(n)
c = 1 # 表示加法
if s.find('+', 1) == -1:
c = 2 # 表示减法
if n[2] == '?':
continue
if c == 1 and int(n[0]) + int(n[1]) == int(n[2]):
sm += 1
continue
elif c == 2 and int(n[0]) - int(n[1]) == int(n[2]):
sm += 1
print(sm)
except EOFError:
print()
0.0分
3 人评分
点我有惊喜!你懂得!浏览:1393 |
WU-输出九九乘法表 (C++代码)浏览:1668 |
WU-链表数据求和操作 (C++代码)浏览:1313 |
C语言程序设计教程(第三版)课后习题10.4 (C语言代码)浏览:535 |
【蟠桃记】 (C语言代码)浏览:1024 |
1024题解浏览:806 |
大家好,我是验题君浏览:577 |
陈教主的三角形 (C语言代码)浏览:1142 |
前10名 (C语言代码)浏览:727 |
C语言程序设计教程(第三版)课后习题12.3 (C语言代码)浏览:543 |