题解 | #DNA序列#

DNA序列

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

def GC_Ratio(s):
    G_n = s.count('G')
    C_n = s.count('C')
    Ratio = (G_n+C_n)/Length
    s_L.append(s)
    Ration_L.append(Ratio)
DNA = input()
Length = int(input())
s_L = []
Ration_L = []
for i in range(len(DNA)-Length+1):
    GC_Ratio(DNA[i:i+Length])
print(s_L[Ration_L.index(max(Ration_L))])

全部评论

相关推荐

积极的小学生不要香菜:你才沟通多少,没500不要说难
点赞 评论 收藏
分享
流浪的神仙:无恶意,算法一般好像都得9硕才能干算法太卷啦
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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