每天一翻译之5

WZB's Harem

 1000ms  131072K

描述:

Do you remember N-queens? Today, WZB accompanied his n queens to the cinema……

As the saying goes: Three queens for a play, one harem admits of no two queens…

Cinema uses n rows of seats, each row has n columns.Queens are grumpy, they're not willing to sit in the same row or same column with other queen, if there are two queens in the same row or same column they conflict occurs, so they make WZB arrange seats for them. It stumped WZB to avoid the queen make antinomy. WZB wants to know how many different arrangements there are for the queen, he'd like to choose one for them.

Since WZB and his queens arrived late, some seats had already been reserved by others. Although WZB is a king, he can't infringe on the rights of citizens, so the reserved seats could not be reserved for queens.

Now WZB has ordered you to work out how many ways to arrange the queen. If WZB finds out your calculations are wrong....

输入:

There is an integer n(n<=20)n(n<=20) in the firstline. The cinema has n rows and n columns of seats.

In the next lines,there are n integers ineach line(0 or 1).If the point(i,j)(i,j) is 11, it means it has been booked.

输出:

One integer.You just need to print the answer Mod 10000000071000000007.

样例输入:

2
0 0
0 0

样例输出:

4

描述:

你还记得n皇后吗?今天,WZB陪他的n皇后去看电影。

俗话说:三个皇后一台戏,一个后宫不可以容下俩个皇后……

电影院使用的是n排座位,每一排都有n行。皇后们脾气暴躁,如果有两个皇后坐在相同的排或行她们会发生冲突,所以,她们让WZB帮她们安排座位。WZB想知道皇后们有多少种不同的安排,他可以为皇后们选择一种。

因为WZB和他的皇后们来晚了,有些座位已经被其他人预定了。虽然,WZB是国王,但是,他不想侵犯公民的权利,因此,已经被预定的座位不能提供给皇后们。

现在,WZB命令你想出到底有多少种方式可以安排皇后,如果WZB发现你的计算有误……

输入:

在第一行有一个整数n(n<=20),电影院有n行n列的座位。

在接下来的几行中,每行有n个整数(0或1)。如果点(i,j)是1,那就意味着该座位被预定。

样例输入:

2

0 0

0 0

样例输出

4

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值