先放上地址:https://ac.nowcoder.com/acm/contest/320#question
1、A+B(1)
while True:
try:
a, b = map(int, input().strip().split())
print(a + b)
except EOFError:
break
2、A+B(2)
while True:
try:
l = list(map(int, input().strip().split()))
if len(l) == 1:
pass
else:
print(sum(l))
except EOFError:
break
3、A+B(3)
while True:
try:
l = list(map(int,input().strip().split()))
if l == [0,0]:
break
else:
print(sum(l))
except EOFError:
break
4、A+B(4)
while True:
try:
l = list(map(int, input().strip().split()))
if l[0] == 0:
break
else:
print(sum(l[1:]))
except EOFError:
break
5、A+B(5)
while True:
try:
l = list(map(int,input().strip().split()))
if len(l) == 1:
pass
else:
print(sum(l[1:]))
except EOFError:
break
6、A+B(6)
while True:
try:
l = list(map(int, input().strip().split()))
print(sum(l[1:]))
except EOFError:
break
7、A+B(7)
while True:
try:
l = list(map(int, input().strip().split()))
print(sum(l))
except EOFError:
break
8、字符串排序(1)
while True:
try:
n=int(input())
mystr=list(map(str,input().strip().split()))
mystr.sort()
print(' '.join(mystr))
except EOFError:
break
9、字符串排序(2)
from fileinput import input
for line in input():
a = line.split()
a = sorted(a)
s = ''
for i in range(len(a)-1):
s+=a[i]+' '
s += a[-1]
print(s.lstrip())
10、字符串排序(3)
from fileinput import input
for line in input():
a = sorted(line.strip().split(','))
s = ''
for i in range(len(a)-1):
s+=a[i]+','
s += a[-1]
print(s)
参考: