Aakash and Maths
All submissions for this problem are available.Aakash is very good at maths. But his friend Arav doesn't think so. So to challenge him, he gives him a problem. He gives him an integer an $L$ and asks him to find the number of arrangements of integers $1$ to $L$ such that each arrangement satisfies the following property: Let the arrangement be: $A_1,A_2,....,A_L.$ The arrangement should be such that there exists a $R$ $(2 ≤ R ≤ L-1)$ such that: $A_k > A$$k + 1$ $ ∀$ $R ≤ k ≤ L-1.$ $A_k > A$$k - 1$ $ ∀$ $2 ≤ k ≤ R.$ Since Aakash is busy, he wants you to help him. ###Input: - First line will contain $T$, number of testcases. Then the testcases follow. - The first and only line of each test case consists an integer, $L$. ###Output: For each testcase, output the answer modulo $1000000007$. ###Constraints - $1 \leq T \leq 100$ - $1 \leq L \leq 10^9$ ###Subtasks - 40 points : $ 1 \leq L \leq 1000 $ - 60 points : Original Constraints ###Sample Input: 2 2 4 ###Sample Output: 0 6 ###Explanation The permutations satisfying the given condition for L=4 are [1,2,4,3], [1,3,4,2], [2,3,4,1], [2,4,3,1], [1,4,3,2], [3,4,2,1].
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.