题解 | #DNA序列#

DNA序列

https://www.nowcoder.com/practice/e8480ed7501640709354db1cc4ffd42a

s = input()
N = int(input())
ls = []
for i in range(0, len(s)):
    ls.append(s[i : i + N])
#print(ls)
lst = []
for i in ls:
    if len(i) == N:
        lst.append(i)
#print(lst)
lsd = []
p = 0
for i in lst:
    if ((i.count("G")) + (i.count("C"))) / len(i) > p:
        lsd.append(((i.count("G")) + (i.count("C"))) / len(i))

print(lst[lsd.index(max(lsd))])  # 注意这个的写法

全部评论

相关推荐

喵_coding:项目太烂了外卖+点评啊 而且寒假实习差不多到时候了 hc没多少了 要实在想要找那只能投投大厂试试了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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