Python题解 | #DNA序列#

DNA序列

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


while True:
    try:
        s = input()
        n = int(input())
        str1 = ''
        res = 0
        ss = ''
        for i in range(len(s) - n + 1):
            str1 = s[i:i + n]
            ans = 0
            for j in str1:
                if j == 'C' or j == 'G':
                    ans += 1
            if ans / len(s) > res:
                res = ans / len(s)
                ss = str1
        print(ss)
    except:
        break

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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