UESTC 1851 Kings on a Chessboard
Kings on a Chessboard
64-bit integer IO format: %lld Java class name: Main
You are given a chessboard of size x * y and k identical kings, and are asked to place all the kings on the board such that no two kings can attack each other. Two kings can attack each other if they are horizontally, vertically or diagonally adjacent.
Write a computer program that calculates the number of possible arrangements of the k kings on the given chessboard. Since the number of feasible arrangements may be large, reduce the number modulo 1,000,000,007.
Input
The first line of the input consists of a single integer T, the number of test cases. Each of the following T lines consists of three integers x; y and k,separated by one space.
0 < T <= 50
2 <= x; y <= 15
1 <= k <= x*y
Output
For each test case, output the number of possibilities modulo 1,000,000,007.
Sample Input
4
8 8 1
7 7 16
7 7 7
3 7 15
Sample Output
64
1
2484382
0
Source
|
#include <iostream>
#include <cstdio> #include <cstring> using namespace std; const int MOD=1000000007; inline bool legal(int x,int y) {return x&y;} bool isOK(int xia,int shang) int main() |
* This source code was highlighted by YcdoiT. ( style: Codeblocks )
UESTC 1851 Kings on a Chessboard的更多相关文章
- LightOJ1171 Knights in Chessboard (II)(二分图最大点独立集)
题目 Source http://www.lightoj.com/volume_showproblem.php?problem=1171 Description Given an m x n ches ...
- CodeForces445A DZY Loves Chessboard
A. DZY Loves Chessboard time limit per test 1 second memory limit per test 256 megabytes input stand ...
- ACM:UESTC - 649 括号配对问题 - stack
UESTC - 649 括号配对问题 Time Limit: 1000MS Memory Limit: 65535KB 64bit IO Format: %lld & %llu ...
- UESTC 1015 Lweb and pepper --前,后缀最值
题意: n种食物,每种含花椒的概率为Pi,现在已经选择了[L,R]这个区间(下标)的食物,要再选一个,使总的食物只有一种含花椒的概率最大,问选哪个最好,相同的选下标小的. 解法: 就不写解法了.此处有 ...
- FJOI省队集训 chessboard
(题目懒得打字了,建议到新窗口查看) 显然这玩意儿是可以按位搞的...然后就是一个裸的最小割模型? 然而这样做理论上只有30分实际上有40分. 事实上我们可以发现,每一列的取值只和上一列有关,这样我们 ...
- [poj2446]Chessboard
Description 给定一个m×n的棋盘,上面有k个洞,求是否能在不重复覆盖且不覆盖到洞的情况下,用2×1的卡片完全覆盖棋盘. Input 第一行有三个整数n,m,k(0<m,n<=3 ...
- POJ2699 The Maximum Number of Strong Kings
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2102 Accepted: 975 Description A tour ...
- UESTC 1852 Traveling Cellsperson
找规律水题... Traveling Cellsperson Time Limit: 1000ms Memory Limit: 65535KB This problem will be judged ...
- UVa12633 Super Rooks on Chessboard(容斥 + FFT)
题目 Source http://acm.hust.edu.cn/vjudge/problem/42145 Description Let’s assume there is a new chess ...
随机推荐
- MATLAB自定义配置
1.设置默认工作路径 一般来说MATLAB的默认工作路径是安装目录下的bin目录,但是,把这个作为自己的工作目录很不方便,以为里面已经有很多安装文件了,容易混淆: 每次打开再更改路径又太麻烦,所以最好 ...
- Canvas绘画功能(待补充)
由于项目的前端需要用户手绘输入,所以我们利用Canvas控件做绘画面板,并且实现了许多功能,包括手绘笔画,清空画板,上传手绘图,下载手绘图,记录用户笔画,上传背景图.以后有时间都写到这篇博客中,今天晚 ...
- sed delete
sed -i '1d' a.txt删首行 sed -i '$d' b.txt删尾行 sed -i 's/[ ]//g' c.txt删空格 sed -i '/^$/d' d.txt删空行 sed -i ...
- kailli添加桌面快捷方式
kailli添加桌面快捷方式 /usr/share/applications/xxx.desktop 注意大小写要与Name对应 [Desktop Entry] Version=1.0 Name=Tu ...
- 安装ubuntu和安装ubuntu后要安装的软件列表
安装ubuntu 老毛桃进入win pe修复启动项 在win pe下面制作ubuntu的安装盘,只用的软件是ultraISO 参考博客下面的分区的那篇文章 http://jingyan.baidu. ...
- nodeJS接受post传过来的参数
1.nodeJs接受Post传递的参数需要通过绑定两个事件来获取, querystring = require("querystring"); 1 app.post('/comm ...
- ecshop订单-》待付款,待发货,待收货,收货确认
// 订单 待付款.待发货.待收货.确认收货 public function get_serch_order($type/*,$limit_statrt,$limit_end,$serch*/){ $ ...
- php ceil() 函数向上舍入为最接近的整数。
代码: <?php echo(ceil(0.60); echo(ceil(0.40); echo(ceil(); echo(ceil(5.1); echo(ceil(-5.1); echo(ce ...
- UITableViewCell的separator分隔线设置失效
// 处理separator -(void)viewDidLayoutSubviews { if ([self.tableView respondsToSelector:@selector(setSe ...
- JAVA个人知识总结
1.一个.java文件中只能有一个public类,且必须跟文件名相同,其他类不能以public开头. 2.继承: 子类继承父类的属性和方法. 3.继承和组合: 继承是对“是一种”(is-a)关系建模, ...