题解 | #DNA序列#
DNA序列
https://www.nowcoder.com/practice/e8480ed7501640709354db1cc4ffd42a
gene , l , rate = input() , int(input()) , [] for i in range(len(gene)): rate.append(gene[i:min(i+l,len(gene))].count('C')+gene[i:min(i+l,len(gene))].count('G')) print(gene[rate.index(max(rate)):rate.index(max(rate))+l]) #相对会耗时但很简短能过