[SOLUTION] Is it Series solution codechef 2021 – Spider AlgoCup Codechef

Is it Series solution codechef 2021

Is it Series solution codechef 2021

Chef define a function F(n)F(n), where he can write F(n)F(n) in the form of sum of Pi/QiPi/Qi for each integer ii (i1i≥1), we can define PiPi as the number of ways to fill nn positions with ii options at each position and Qi is number of ways to fill ii positions with 22 options at each position.

Formally, Pi=inPi=inQi=2iQi=2iF(n)F(n) = ΣPi/QiΣPi/Qi ( i1i≥1)

As the F(n)F(n) can be large, the chef asked you to solve and output F(n)F(n) modulo 109+7109+7.

Input: Is it Series solution codechef 2021

  • First line will contain TT, number of testcases. Then the testcases follow.
  • Each testcase contains a single line of input, one integers nn.

Output: Is it Series solution codechef 2021

For each testcase, output in a single line F(n)F(n) modulo 1000000007.

Constraints Is it Series solution codechef 2021

  • 1T1051≤T≤105
  • 1n60001≤n≤6000

Sample Input: Is it Series solution codechef 2021

3
1
2
3 

Sample Output: Is it Series solution codechef 2021

2
6
26

Is it Series solution codechef 2021

EXPLANATION:

First Test case has n=1n=1,Pi=i1Pi=i1Qi=2iQi=2iF(1)=Σi1/2iF(1)=Σi1/2i and i1i≥1 = 2.

 

 

Program Code :

We don not promote cheating in any sense, so try your best and if you want solution you can check it after a day.

Thank You 

ALL THE BEST.

[SOLUTION] Is it Series solution codechef 2021 - Chef define a function F(n)F(n)

Also read : Flower Sequence solution codechef 2021

 

Leave a Comment