百度测开笔试

第一题:
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)
选择题不记得了,非科班计算机知识的广度不够的劣势让我败在这次笔试选择题中#百度##笔试题型#
全部评论

相关推荐

05-29 22:11
门头沟学院 Java
Elastic90:抛开学历造假不谈,这公司的招聘需求也挺怪的,Java开发还要求你有图文识别、移动端开发和c++的经验,有点逆天了。
点赞 评论 收藏
分享
流浪的神仙:无恶意,算法一般好像都得9硕才能干算法太卷啦
点赞 评论 收藏
分享
评论
1
3
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务