编程介的小学生 2019-06-26 23:56 采纳率: 20.5%
浏览 94

在象棋中的皇后的排列的一个问题,怎么使用C语言的程序的设计的编写的技术的方式去实现的过程

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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料