Answered step by step
Verified Expert Solution
Question
1 Approved Answer
dna:Pls help for this programing problem in c++ (standard IO without file read/write),better with some comment about why coding that way,thanks Problem C: The DNA
dna:Pls help for this programing problem in c++ (standard IO without file read/write),better with some comment about why coding that way,thanks
Problem C: The DNA Sequence time limit: 2 sec Problem Description DNA of a creature can be thought of as a sequence of 4 characters of A, T, C and G. Because the length of the sequence of DNA is too long to be studied, we hope to find some more important segments of the sequence. Some segments that have the maximal density of C or G are interesting to biologists but the segment can't be too short. We request you write a program to find a segment that has the most density of C or G. A substring of the string is a consecutive segment of the string. If the length of substring is L and the number of C or G is w. The CG-density of the substring is defined as wIL. The input of the program has an integer L (between 5 and 40) and a string of DNA. The program must find a substring of length at least L and the CG-density is maximal. The string of the input is less than 120 and this string consists of only A, T, C and G but mixed with upper or lower cases (e.g. ATCGatcg). Input File Format The input has several lines, the first line contains an integer which indicates the number of test cases. In each case, the first integer is L, and followed by the string of DNA. Output Format For each case, output the maximal density to three digits after decimal point. Example Sample Input: Sample Output: 833 414 5 agGCTGCAatGACAGTTGGG 20 AaggctatacagtactaatCtTtTgcatggcStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started