题目一: import sys try: while True: line = sys.stdin.readline().strip() if line == '': break sum=0 for i in range(1,101): sum+=i if sum == int(line) and int(line)!=5050: print i break if sum==5050 and int(line)==5050: #注意刚好等于
题目一:
try:
while True:
line = sys.stdin.readline().strip()
if line == '':
break
sum=0
for i in range(1,101):
sum+=i
if sum == int(line) and int(line)!=5050:
print i
break
if sum==5050 and int(line)==5050: #注意刚好等于5050的情况
print 100
elif sum==5050:
print 'No'
# lines = line.split()
# print int(lines[0]) + int(lines[1])
except:
pass
测试用例通过100%
题目二:
input_2=raw_input('')
list2=[]
for j in input_2:
list2.append(j)
str=''
for i in input_1:
if i not in list2:
str+=i
print str
测试用例通过67%,暂时不知道问题出在哪里