YAPP - Yet Another Permutations Problem
How many permutations of the first N numbers exist such that the maximum element between the indices [i..j] is either present at index i, or at index j ?
The first line contains the number of test cases T. Each of the next T lines contains an integer N
Output T lines containing the required answer for the corresponding test case. Since the answers can get really big, output the result modulo 1000000007.
Sample Input: 1 2 Sample Output: 2
1 <= T <= 10000
1 <= N <= 1000000000
More test cases pls
Anubhav Balodhi :
Doing too much PnC makes this problem very simple ;-D
very easy move it to tutorial...& n=5 ans is 16.
(Tjandra Satria Gunawan)(æ›¾æ¯…æ˜†):
optimize I/O, use precomputation, then AC 0.02s :)
@Varun : what are i and j exactly....they are not in test cases...y are they needed??
prob is too hard to understand and the trivial sample test case contributes to it greatly......:(
Numbers mean natural numbers?
what is the answer for n=5???
wat will be the answer for N=1....