Submeter | Todas submissőes | Melhores | Voltar |
Problem hidden
ADACHES2 - Ada and Palaces |
Ada the Ladybug was playing chess against her good friend Velvet Mite Vinit. They came up with new figure, called palace. In fact, palace is just tower with king inside. It can attack as king and tower combined: Either anywhere to same column or row or anywhere to adjacent (by side or diagonal) field.
Their question is simple: How many ways can N palaces be placed on N×N chessboard so none of them attacks any other. Since this number might be pretty big, output answer modulo 109+7
Input
The first line of input will contain 1 ≤ T ≤ 105, the number of test-cases.
Each of the testcases will contain single integer 1 ≤ N ≤ 107, the size of chessboard.
Output
For each test-case output the number of possibilities modulo 1000000007.
Example Input
8 1 2 3 7 10 1000 10000 9999999
Example Output
1 0 0 646 479306 711794305 450342414 838796194
Adicionado por: | Morass |
Data: | 2017-10-22 |
Tempo limite: | 2s |
Tamanho do fonte: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Linguagem permitida: | Todas exceto: ASM64 CLOJURE ERL FSHARP PERL6 PY_NBC SCALA TCL |