【笔试题目】小米2020秋招测试开发

题目一:
【笔试题目】小米2020秋招测试开发_第1张图片

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:      #注意刚好等于5050的情况
            print 100
        elif sum==5050:
            print 'No'
        # lines = line.split()
        # print int(lines[0]) + int(lines[1])
except:
    pass

测试用例通过100%

题目二:
【笔试题目】小米2020秋招测试开发_第2张图片

input_1=raw_input('')
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%,暂时不知道问题出在哪里

你可能感兴趣的:(笔试题目)