美团 9.20 测开笔试
	第一题:六位数
m,n=map(int,input().split()) count=0 for i in range(m,n+1): cur=str(i) tmp=set(cur) if len(tmp)==6 and int(cur[:2])+int(cur[2:4])-int(cur[4:])==0: count+=1 print(count)
	第二题:小美的新游戏(类似机器人有障碍路径),开始位置也要置为'+'。
n,m,p,q=map(int,input().split()) path,res=[],[] for _ in range(n): path=list(input()) res.append(path) step=input() for i in range(n): for j in range(m): if res[i][j]=='S': res[i][j]='+' x,y=i,j break count=0 for i in step: if i=='W': if x==0 or res[x-1][y]=='#': continue if res[x-1][y]=='O': count+=p res[x-1][y]='+' x-=1 elif res[x-1][y]=='X': count-=q res[x-1][y]='+' x-=1 elif res[x-1][y]=='+': x-=1 elif i=='S': if x==n-1 or res[x+1][y]=='#': continue if res[x+1][y]=='O': count+=p res[x+1][y]='+' x+=1 elif res[x+1][y]=='X': count-=q res[x+1][y]='+' x+=1 elif res[x+1][y]=='+': x+=1 elif i=='A': if y==0 or res[x][y-1]=='#': continue if res[x][y-1]=='O': count+=p res[x][y-1]='+' y-=1 elif res[x][y-1]=='X': count-=q res[x][y-1]='+' y-=1 elif res[x][y-1]=='+': y-=1 else: if y==m-1 or res[x][y+1]=='#': continue if res[x][y+1]=='O': count+=p res[x][y+1]='+' y+=1 elif res[x][y+1]=='X': count-=q res[x][y+1]='+' y+=1 elif res[x][y+1]=='+': y+=1 print(count)
	第三题:小美找朋友(类似子序列)
n,m=map(int,input().split())
s1=input()
s2=input()
Flag=True
index,cur=-1,-1
res=[]
for c in s2:
    if s1.find(c)==-1:
        Flag=False
if Flag:
    for c in s2:
        index=s1.find(c,index+1)
        if index<cur:
            Flag=False
            break
        cur=index
        res.append(index)
if Flag:
    print('Yes')
    print(sum(res)+len(s2))
else:
    print('No')
	第四题:小美的美丽树(子树的最大值最小值之差)😛 
print(2)
#笔试题目#
查看7道真题和解析