#include <cstdio> #include <cstring> #include <iostream> #include <cmath> #include <algorithm> #include <queue> #include <vector> using namespace std; ; ; const int INF = 0x3f3f3f3f; struct Edge{ int u,v,flow,cap,…
G - Game of Hyper Knights Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Description A Hyper Knight is like a chess knight except it has some special moves that a regular knight cannot do. Alice and Bob are p…
1010 - Knights in Chessboard    PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 32 MB 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 chess…
题目连接: http://www.lightoj.com/volume_showproblem.php?problem=1010 题目描述: 有一个n*m的棋盘,根据象棋中马走日字的规则,问此棋盘最多可以存放多少个马,并且任意两个马之间不会相互攻击. 解题思路: 从题目中给的棋盘可以看出,如果我们只把马放在白格子或者只把马放在黑格子的话都是合法的,但是是不是最优呢? 仔细考虑一下就可以得出: 当min(n, m) == 1的时候,把格子放满马也是没事的, 当min(n, m) == 2的时候,可…
题目链接:https://vjudge.net/contest/28079#problem/B 题目大意:给你一个nxm的棋盘,问你最多可以放几个骑士让他们互相攻击不到.骑士攻击方式如下图: 解题思路:当m和n都大于2时,ans=(m*n+1)/2 当m或n有一个为1时,ans=m*n 当m或n有一个为2时,那么我们可以考虑可以分出多少个2*2的格子(t田字格) ,那么我们可以一次把一个田字格全部放上马,然后间隔一个田字格,然后再放马,使m=max(n,m),判断田字格两两匹配后剩下的格子数tm…
题目 Source http://www.lightoj.com/volume_showproblem.php?problem=1171 Description Given an m x n chessboard where some of the cells are broken. Now you are about to place chess knights in the chessboard. You have to find the maximum number of knights…
lightoj 1010 Knights in Chessboard 链接:http://lightoj.com/volume_showproblem.php?problem=1010 题意:国际象棋规则,在 m*n 的格子放某一棋子,棋子可以沿着它的8个方位直走,问盘子可以放多少个这样的棋子而使任意两个不发生冲突. 思路:数学水题,找下算出几组,找下规律就出来了.值得注意的是有特判. 代码: #include <iostream> #include <cstdio> #inclu…
http://lightoj.com/volume_showproblem.php?problem=1422 做的第一道区间DP的题目,试水. 参考解题报告: http://www.cnblogs.com/ziyi--caolu/p/3236035.html http://blog.csdn.net/hcbbt/article/details/15478095 dp[i][j]为第i天到第j天要穿的最少衣服,考虑第i天,如果后面的[i+1, j]天的衣服不要管,那么dp[i][j] = dp[i…
Knights of the Round Table Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 12439   Accepted: 4126 Description Being a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress, and drinking with the oth…
Knights of the Round Table Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 10911   Accepted: 3587 Description Being a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress, and drinking with the oth…