Counting Problem

问题描述 :

  Yes. Counting problem comes again. 
  Given a chess board of N*N (N<=500), how many ways are there to put N queens on it so that no queen can attack another? 
  Luckily this is not the problem you should solve in this contest. Instead, we have a much easier one here.
  Given a chess board of N*N (N<=500), how many ways are there to put 2*N queens on it so that there are exactly two queens in each row and each column?
  To make it even easier, we will consider one way to be the same with another if it can be transformed to the other one by swapping rows and swapping columns.

输入:

  The first line of the input is an integer T indicating the number of cases. 
  Line 2..T+1 will contain an positive integer N (N <=500) each.

输出:

  The first line of the input is an integer T indicating the number of cases. 
  Line 2..T+1 will contain an positive integer N (N <=500) each.

样例输入:

3
2
5
4
样例输出:

1
2
2

http://blog.csdn.net/nmfloat/article/details/46802753