题目大意:有n个骑士经常举行圆桌会议,每次圆桌会议至少要有3个骑士参加(且每次参加的骑士数量是奇数个),且所有互相憎恨的骑士不能坐在圆桌旁的相邻位置,问有多少个骑士不可能参加任何一个会议解题思路:以骑士为点建立无向图G。如果两个骑士可以相邻(即他们并不互相憎恨),即可连一条边。
则题目就转化为求不在任何一个简单奇圈上的结点个数
首先,圈就是一个双连通的分量,所以第一件事就是将所有的双连通分量求出...
分类:
其他好文 时间:
2015-08-08 00:03:11
阅读次数:
206
题目连接: http://www.lightoj.com/volume_showproblem.php?problem=1010题目描述: 有一个n*m的棋盘,根据象棋中马走日字的规则,问此棋盘最多可以存放多少个马,并且任意两个马之间不会相互攻击。解题思路; 从题目中给的棋盘可以看出,如果我们...
分类:
其他好文 时间:
2015-07-14 22:27:10
阅读次数:
167
POJ 3170 Knights of Ni(两次BFS啊)...
分类:
其他好文 时间:
2015-07-13 12:10:40
阅读次数:
132
题意:多个骑士要开会,3人及以上才能凑一桌,其中部分人已经互相讨厌,肯定不坐在同一桌的相邻位置,而且一桌只能奇数个人才能开台。给出多个人的互相讨厌图,要求多少人开不成会(注:会议不要求同时进行,一个人开多个会不冲突)?分析: 给的是互相讨厌的图,那么转成互相喜欢的吧,扫一遍,如果不互相讨厌就认为互....
分类:
其他好文 时间:
2015-07-06 19:30:52
阅读次数:
120
直接模拟就好了,好像没有什么巧办法~ 1 #include 2 3 using namespace std; 4 5 struct point { 6 int x; 7 int y; 8 }q[105], k[105]; 9 10 int ans; 11 c...
分类:
其他好文 时间:
2015-06-11 20:46:51
阅读次数:
127
Given an m x n chessboard where you want to place chess knights. You have to find the number of maximum knights that can be placed in the chessboard such that no two knights attack each other.Those who...
分类:
其他好文 时间:
2015-06-08 17:32:11
阅读次数:
118
Description
Being a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress, and drinking with the other knights are fun things to do. Therefore, it is not ...
分类:
其他好文 时间:
2015-05-22 19:15:03
阅读次数:
165
解题报告 之 SOJ 3312 Stockholm Knights 最大流 网格 动态流 二分
The city of Stockholm is a chessboard whose size is N*M.
There are some Stockholm Knights in the city.
Stockholm Knights are very special Knights.
They only can move from a corner of a 3*4 grid to the oppo...
分类:
其他好文 时间:
2015-04-27 09:50:20
阅读次数:
166
摘自:超级无敌python教程 dict的循环: >>>?knights?=?{‘gallahad‘:?‘the?pure‘,?‘robin‘:?‘the?brave‘}
>>>?for?k,?v?in?knights.items():
????????...?
????????print?k,?v
?...
分类:
编程语言 时间:
2015-04-26 15:22:09
阅读次数:
150