题解 | #DNA序列#
#可能比较耗时但很短的代码 gene = input() l = int(input()) rate = [] 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])
#可能比较耗时但很短的代码 gene = input() l = int(input()) rate = [] 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])
相关推荐