Chunk’s chunky Party
All submissions for this problem are available.This is the holiday season, and the chunk is inviting the best coders to his annual winter party. He invites $N$ people, and they all enter one after the other. The chunk has arranged a ludo competition in his party, and needs to divide all his friends into pairs to play the game. Note : if any invitee is left unpaired, that person will play against the chunk, otherwise the chunk will not participate. The chunk decides the number of ways the invitees can be paired at any instant to be called the magic number of the party $M$. For example, if there are 3 people invited, the magic number at the 1st instance is $1$, because the 1st person to arrive at the party is paired with the chunk. When the 2nd person arrives, he is paired with the 1st invitee, and the chunk doesn’t play. Thus the magic number is $1$. When the 3rd guest arrives, he has 3 people to play with (Counting the chunk because one person will be left unpaired), Then the remaining 2 people will play against each other. Thus the magic number is $3$. The chunk wants to find out the magic number when all the guests have entered the party. Help him find this number out. ###Input: - First line will contain $T$, number of test cases. Then the test cases follow. - Each test case contains a single integer $N$, the number of guests invited to his party. ###Output: - For each test case print M. Since the outputs may be large, print it modulo 10000000007. ###Constraints - $1 \leq T \leq 10^6$ - $2 \leq N \leq 10^6$ ###Sample Input: 3 1 2 3 ###Sample Output: 1 1 3
|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.