0 点赞 评论 收藏
分享
0 点赞 评论 收藏
分享
cxyzqqq:#include <iostream> #include <string> using namespace std; int main() { string s; int n; while (cin >> s >> n) { int left = 0, right = 0; double gc_num = 0; double max_ratio = 0; int start = 0; while (right < s.size()) { if (s[right] == 'G' || s[right] == 'C') gc_num++; int len = right-left+1; if (len > n) { if (s[left] == 'G' || s[left] == 'C') gc_num--; left++; } double ratio = gc_num / n; if (ratio > max_ratio) { max_ratio = ratio; start = left; } right++; } cout << s.substr(start, n) << endl; } return 0; }</string></iostream>
0 点赞 评论 收藏
分享
关注他的用户也关注了: