题解 | #DNA序列#

DNA序列

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

str1 = input()
num = int(input())
max_str = [0,0]
if len(str1)-num> 0:
    for i in range(len(str1)-num):
        son_str = str1[i:i+num]
        if (son_str.count('C')+son_str.count('G'))/num > max_str[0]:
            max_str[0] = (son_str.count('C')+son_str.count('G'))/num
            max_str[1] = son_str
    print(max_str[1])
else:
    print(str1)

全部评论

相关推荐

不愿透露姓名的神秘牛友
昨天 12:10
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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