python

P1001 A+B Problem

173Jjx @ 2023-11-04 12:06:55

怎么用python写这道题呢


by dtw35l @ 2023-11-14 20:50:23

@BillsgWu %%%%


by xzj2004 @ 2023-11-22 16:46:40

a,b=map(int,input().split()) if a<0: a = -a if b<0: b = -b print(a+b)


by Tseshongfeeshur @ 2023-12-10 08:50:48

最短Python3

n=input();print(int(n.split(" ")[0])+int(n.split(" ")[1]))

by hyh0174 @ 2023-12-15 21:56:33

还有更短

print(sum(map(int,input().split())))

by __youzimo2014__ @ 2023-12-26 20:51:08

我是python大佬

a, b = input("").split()
print(a+b)

by __youzimo2014__ @ 2024-01-30 10:41:27

@Huyuhao0215 input函数是直接输入一行,你这样会爆异常


by __youzimo2014__ @ 2024-01-30 10:44:12

忘了split不能这样用哈

n = input("").split();
print(n[0], n[1]);

类型转换大法:

n = input("").split();
print(str(n[0])+' '+str(n[1]));

上一页 |