case there are two planes and a molecule is shot with rot age 3 (towards the right), the cycle is as per the following: (here, D(x) alludes to a solitary molecule with rot age x)    the primary plane delivers a D(2) to the left and lets D(3) progress forward to the right;    the subsequent plane delivers a D(2) to the left and lets D(3) progress forward to the right;

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.5: Case Studies
Problem 15E
icon
Related questions
Question
100%

Correct answer will be upvoted else downvoted. Computer science.

 

 in case there are two planes and a molecule is shot with rot age 3 (towards the right), the cycle is as per the following: (here, D(x) alludes to a solitary molecule with rot age x) 

 

the primary plane delivers a D(2) to the left and lets D(3) progress forward to the right; 

 

the subsequent plane delivers a D(2) to the left and lets D(3) progress forward to the right; 

 

the primary plane lets D(2) forge ahead to the left and creates a D(1) to the right; 

 

the subsequent plane lets D(1) progress forward to one side (D(1) can't create any duplicates). 

 

Altogether, the last multiset S of particles is {D(3),D(2),D(2),D(1)}. (See notes for visual clarification of this experiment.) 

 

Gaurang can't adapt up to the intricacy of the present circumstance when the number of planes is excessively huge. Help Gaurang find the size of the multiset S, given n and k. 

 

Since the size of the multiset can be extremely huge, you need to output it modulo 109+7. 

 

Note: Particles can go to and fro between the planes without crashing into one another. 

 

Input 

 

The primary line of the input contains the number of experiments t (1≤t≤100). Then, at that point, t lines follow, each containing two integers n and k (1≤n,k≤1000). 

 

Moreover, the amount of n over all experiments won't surpass 1000, and the amount of k over all experiments won't surpass 1000. All experiments in a single test are unique. 

 

Output 

 

Output t integers. The I-th of them ought to be equivalent to the response to the I-th experiment.

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Probability Problems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr