
状态压缩dp
文章平均质量分 59
brucehb
这个作者很懒,什么都没留下…
展开
-
第十二届蓝桥杯 ——国际象棋
题目描述众所周知,“八皇后” 问题是求解在国际象棋棋盘上摆放 8个皇后,使得两两之间互不攻击的方案数。已经学习了很多算法的小蓝觉得 “八皇后” 问题太简单了,意犹未尽。作为一个国际象棋迷,他想研究在 N × M的棋盘上,摆放 K个马,使得两两之间互不攻击有多少种摆放方案。由于方案数可能很大,只需计算答案除以 1000000007(即10^9+7) 的余数。如下图所示,国际象棋中的马摆放在棋盘的方格内,走 “日” 字,位于 ( x , y ) 格的马(第 x行第 y 列)可以攻击(...原创 2022-02-03 21:36:08 · 7121 阅读 · 0 评论 -
poj - 2411 Mondriaan's Dream
DescriptionSquares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his toilet paper to draw on,...原创 2019-03-15 01:36:46 · 217 阅读 · 0 评论 -
poj 3311 Hie with the Pie
DescriptionThe Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfortunately, due to cutbacks, they can afford to hire only one driver to do the deliveries. ...原创 2019-03-20 01:29:33 · 158 阅读 · 0 评论 -
poj 1185 炮兵阵地
Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原(用"P"表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范围如图中黑色区域所示:如果在地图中的灰色所标识的平原上部署一支炮兵部队,则图中的黑色的网格表示...原创 2019-03-21 00:35:29 · 150 阅读 · 0 评论 -
hdu 3001 Travelling
Problem DescriptionAfter coding so many days,Mr Acmer wants to have a good rest.So travelling is the best choice!He has decided to visit n cities(he insists on seeing all the cities!And he does not ...原创 2019-03-22 00:21:09 · 182 阅读 · 0 评论 -
poj 3254 Corn Fields
DescriptionFarmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of squares. ...原创 2019-03-18 23:55:47 · 153 阅读 · 0 评论 -
hdu 3006 The Number of set
Problem DescriptionGiven you n sets.All positive integers in sets are not less than 1 and not greater than m.If use these sets to combinate the new set,how many different new set you can get.The giv...原创 2019-03-23 23:16:06 · 157 阅读 · 0 评论 -
【洛谷P1896【SCOI2005】】互不侵犯King
题目描述在N×N的棋盘里面放K个国王,使他们互不攻击,共有多少种摆放方案。国王能攻击到它上下左右,以及左上左下右上右下八个方向上附近的各一个格子,共8个格子。输入输出格式输入格式:只有一行,包含两个数N,K ( 1 <=N <=9, 0 <= K <= N * N)输出格式:所得的方案数输入输出样例输入样例#1:3 2输出样例#1:...原创 2019-03-28 01:42:44 · 243 阅读 · 0 评论