#携程笔试# 水果组合题在自己电脑上运行结果是对的,提交出现了EOF when reading a line错误。有人知道原因嘛?

a=input().split(',')
b = [[item.count('a'), item.count('p')] for item in a]
m = int(input())
n = int(input())

def dp(index, m, n):
    if m <= 0 or n <= 0 or index < 0:
        return 0
    res = dp(index-1, m, n)
    if b[index][0] <= m and b[index][1] <= n:
        res = max(res, dp(index-1, m-b[index][0], n-b[index][1])+1)
    return res

print(dp(len(b)-1, m, n))
全部评论
while true: xxxxxxxxxxxxxxx except: break 这样的格式写
点赞 回复 分享
发布于 2021-04-29 19:13

相关推荐

牛客29046817...:优化一下简历,突出重点,简历上的技能复习扎实,实习工作啥的整理成文档梳理一下怎么说要有自己的思考在里边,岗位的话运维,测试,开发,实施,技术支持能投的都投,多投递能找到的,秋招投递了3个月左右(8月中旬到11月下旬),boos打招呼8000多次,官网投递300多家,才找到一家满意的
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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