F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Counting Problem

Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 623    Accepted Submission(s): 336


Problem Description
      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.
 

Input
      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.
 

Output
      T lines containing your counting results respectively.
      For the number may be very large, you just have to output its module by 1000007.
 

Sample Input
3 2 5 4
 

Sample Output
1 2 2
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 08:44:42, Gzip enabled