题解 | DNA序列
string_dna = input() n = int(input()) result = 0 result_dna = '' for i in range(len(string_dna)-n+1): c_num = string_dna[i:i+n].count('C') g_num = string_dna[i:i+n].count('G') if (c_num+g_num)/n > result: result = (c_num+g_num)/n result_dna = string_dna[i:i+n] print(result_dna)
很简单