Sonic And Paths
All submissions for this problem are available.
Sonic's friend AKS has to come to visit Rourkela for INNOVISION, 2K17. It's been a long time since they have met, so Sonic decides to go to the station to pick him. The route from Sonic's college to the station can be considered as a (N X 1) grid where Sonic is at position (0, 0) and AKS is at position (N, 1). Sonic can go to adjacent co - ordinates in all possible directions except south - east and north - west. He decides not to visit any co - ordinate twice as he considers it as a waste of time and energy and he cannot move outside the grid. Now, Sonic wonders in how many possible ways he can reach to his friend AKS at position (N, 1). Please help him calculate the answer.
- First line contains T denoting the number of test cases.
- T lines follow each containing a single integer 'N' denoting the position of AKS.
- For each test case output in a new line the number of possible ways modulo (10 ^ 9 + 7).
- 1 ≤ T ≤ 1000
- 0 ≤ N ≤ 10 ^ 9
Input: 4 0 1 2 4 Output: 1 3 9 105
In test case 2: The number of paths are numbered below: The ways are: (0, 0) -> (0, 1) -> (1, 1) (0, 0) -> (1, 0) -> (1, 1) (0, 0) -> (1, 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, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions