Question: Can you solve the problem with Dynamic Programming DP[] way, and if it's possible can you help with c++ code Reinhold is a geneticist who

 Can you solve the problem with Dynamic Programming DP[] way, and

if it's possible can you help with c++ code Reinhold is a

geneticist who examines how molecules combine to form DNA, which contains all

Can you solve the problem with Dynamic Programming DP[] way, and if it's possible can you help with c++ code

Reinhold is a geneticist who examines how molecules combine to form DNA, which contains all of life's information. He understands that DNA must include at least N molecules in order to create a specific creature. Despite the fact that natural DNA is made up of just four molecules, he discovered that in his laboratory, he can combine M molecules to make artificial DNA. However, there are significant limitations, such as the inability to connect certain molecules one after the other. For example, the restriction (A, D), can not combine molecules a and d to form AD, but it can combine them and form DA or ATD. A valid DNA is any combination of M molecules of length N that satisfies all K constraints. Reinhold needs to figure out how many different molecule combinations of length N can make up a valid DNA strand. Because this is such a huge number, he will expect as a result the rest of the division of this number (modulo) by 666013. Data format: Input: The input file is called "dna.in". The first line contains 3 numbers: N, M and K. Then the on the next k lines: on each line there are 2 numbers, i andj, that signify the existence of the constraint (Ai, Aj). Output: The output file is called "dna.out". Only one number will be written in the output file, that represents the number of valid combinations of length N modulo 666013. The operation A modulo B represents the rest of the division of A to B. The operation has the following properties: (A+B) % C = ((A% C) + (8 % C)) %C (A*B) % C = ((A%C)* (B% C)) % C Data limits: 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!