#携程笔试# 水果组合题在自己电脑上运行结果是对的,提交出现了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))
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
这样的格式写
相关推荐
真的很糟糕:不错不错,这么长的文章我竟然看完了
点赞 评论 收藏
分享
12-02 16:43
门头沟学院 Java 点赞 评论 收藏
分享
等闲_:感觉有好多地方会被问穿,mysql存储向量这个方案问题应该很大的,如果深问的的话,为什么不用es,不用pg,不用mivus,分块策略是怎么做的,向量化是怎么向量化的,稠密向量还是稀疏向量,再深问余弦相似度,HSWM算法,Bm25算法,为什么不用混合检索或者Rank重排序优化?其他的项目不停机分库分表咋实现的,切库过程中数据有diff的话有没有补偿策略?既然有了分库分表了有没有碰到业务上不好优化的慢sql,让这个sql读从库?而且点评的话,最好自己压测过,要不这个数据也不好解释。现在就27的情况来看,很多同学已经有了中大厂实习,这个节点也会偏向这些有大厂实习的92同学,而且hc也不多,所以坚持海投吧 点赞 评论 收藏
分享
