while True: try: x,y=map(int,input().split()) s=input() for i in s: if i=="U": y+=1 elif i=="D": y-=1 elif i=="L": x-=1 elif i=="R": x+=1 ans=str(x)+" "+str(y) print(ans) except:break第二题:
n,m,k=map(int,input().split()) a=[] for i in range(n): a.append(list(map(int,input().split()))) a.sort(key=lambda x:(-x[2],x[0],x[1])) price=0 weight=0 ans=0 for i in a: if price+i[0]<=k and weight+i[1]<=m: price+=i[0] weight+=i[1] ans+=1 else: continue print(ans)选择题不记得了,非科班计算机知识的广度不够的劣势让我败在这次笔试选择题中
全部评论
(0) 回帖