mercredi 13 octobre 2021

N rows. The first row 1 to N. Then the next line will contain N-1 numbers, In second row, first number summation of the first two

Now a days, Ohani has become very expert in mathematics. Her teachers like her very much because of her excellent performance. One day, one of her teacher gave her a problem to solve. He will give Ohani a number N. This will represent a table of N rows. The first row contains number from 1 to N. Then the next line will contain N-1 numbers, In the second row, the first number will be the summation of the first two numbers (1 + 2 ) of the previous row, the second number will be the summation of the second two numbers (2 + 3) of the previous row and so on. Row 3 will have N-2 numbers with same procedures. Same procedure follows for row 4, row 5, .... , row N. On the last row, there will be only a single number. Ohani has to tell that only number of the Nth row. For example: If N = 4, then the table is: 1 2 3 4 3 5 7 8 12 20 So Ohani has to answer the last remaining number: 20. She can answer when N is small, but can't when N is large. Can you help her? Input The first line contains the number of testcases T (T<=100000). Each of the test cases contain a number N where 1<=N<=100000. Output You have to output the case number and the required answer. As the number can be very large, output the answer modulo 1000000007. Example: Input 2 1 2 Output Case 1: 1 Case 2: 3

Aucun commentaire:

Enregistrer un commentaire