日常无聊打发时间,刷刷题,由于不记得以前的号了,正好重新码起,以前都是用C++做题的,现在使用python3.8,复习复习算法的过程中顺便熟悉熟悉python的使用,第一篇多说点,后面就不说明了。
好了,进入正题
ZOJ1001 :https://zoj.pintia.cn/problem-sets/91827364500/problems/91827364500
A + B Problem
Time Limit: 2000 msMemory Limit: 65536 KB
Calculate a + b
Input
The input will consist of a series of pairs of integers a and b,separated by a space, one pair of integers per line.
Output
For each pair of input integers a and b you should output the sum of a and b in one line,and with one line of output for each line in input.
Sample Input
1 5
Sample Output
6
Hint
Use + operator
翻译:(由于直接复制腾讯翻译出来的结果,可能存在句意不明,看不懂的地方之间看上面原文,自己译)
A+B问题
时限:2000毫秒内存限制*65536 KB
计算a+b
输入
输入将由一系列整数a和b组成,用空格分隔,每一行有一对整数。
输出量
对于每一对输入整数a和b,您应该在一行中输出a和b的和,并为输入的每一行输出一行输出。
样本输入
1 5
样本输出
6
暗示
使用+运算符
代码:
try:
while True:
a=input().split()
print(int(a[0]) + int(a[1]))
except EOFError:
pass
最基础的A+B问题,不过多描述了,注意,要加try,不然会报错