题意:给你一个n*m方格 让你用1*2的的小方格去铺满,其中有k个方格不能被铺到。
思路:二分图建图, 以每个格子为点建图,如果可以用一块1*2的小方格铺到,就连一条边。
每个格子在X集合和Y集合都有一个点,只要任意一边被匹配到了就算可以,然后就是二分图匹配了。
上代码。
#include
#include
#include
#include...
分类:
其他好文 时间:
2014-05-14 00:17:28
阅读次数:
285
POj 2262 Goldbach's Conjecture...
分类:
数据库 时间:
2014-05-13 23:48:45
阅读次数:
511
题目来源:POJ 2992 Divisors
题意:。。。
思路:素数分解的唯一性 一个数可以被分解成若干素数相乘 p1^x1*p2^x2*...*pn^xn
根据乘法原理 因子数为 (x1+1)*(x2+1)*...*(xn+1)
不能直接求出组合数 会溢出 也不能把每个乘的数分解因子 这样会超时
C(N,M)=N!/(M!*(N-M)!)
另dp[i][j] 代表为i的阶乘中j因子...
分类:
其他好文 时间:
2014-05-13 09:28:07
阅读次数:
207
POJ 3278 Catch That Cow...
分类:
其他好文 时间:
2014-05-13 08:23:36
阅读次数:
328
题目来源:POJ 1006 Biorhythms
题意:给出3个周期第一次发生的时间 和 当前开始的天数 求三个周期下一次到达高峰期发生在哪一天
思路:这题很水 试一下我的模版而已
#include
#include
using namespace std;
typedef long long LL;
const int maxn = 10;
int a[maxn], m[maxn];
...
分类:
其他好文 时间:
2014-05-13 05:07:28
阅读次数:
253
单点修改树中某个节点,查询子树的性质.DFS序
子树序列一定在父节点的DFS序列之内,所以可以用线段树维护. 1: /* 2: DFS序 +线段树 3: */ 4: 5: #include 6:
#include 7: #include 8: #include 9: #include 10: #in...
分类:
其他好文 时间:
2014-05-12 20:15:56
阅读次数:
317
Y2K Accounting BugTime Limit:1000MSMemory
Limit:65536KTotal Submissions:9632Accepted:4806DescriptionAccounting for
Computer Machinists (ACM) has suffe...
分类:
其他好文 时间:
2014-05-12 19:47:15
阅读次数:
462
Squares
Time Limit: 3500MS
Memory Limit: 65536K
Total Submissions: 15489
Accepted: 5864
Description
A square is a 4-sided polygon whose sides have equal length and adja...
分类:
其他好文 时间:
2014-05-11 20:56:36
阅读次数:
416
题目链接:http://poj.org/problem?id=3468
A Simple Problem with Integers
Time Limit: 5000MS
Memory Limit: 131072K
Total Submissions: 56005
Accepted: 16903
Case Time Limit...
分类:
其他好文 时间:
2014-05-11 18:40:16
阅读次数:
301