http://poj.org/problem?id=1692 这题看完题后就觉得我肯定不会的了,但是题解却很好理解.- - ,做题阴影吗 所以我还是需要多思考. 题目是给定两个数组,要求找出最大匹配数量. 匹配规则是: a[i] ==b[j],而且需要产生交叉,而且没对数只能匹配一次. 一开始的时候我被交叉吓到了,怎么判断交叉啊? 分析: 对于a[]的第i个数,b数组的第j个数,假设a[i] != b[j] 如果它能产生匹配,那么就需要, 对于a[i]这个数字,在b[]的前j - 1个找到和他数…
Description There are two rows of positive integer numbers. We can draw one line segment between any two equal numbers, with values r, if one of them is located in the first row and the other one is located in the second row. We call this line segmen…
经典DP,想了很久,开始想复杂了. #include <iostream> using namespace std; #define MAXNUM 100 int mymax(int a, int b) { return (a>b) ? a:b; } int main() { int case_n; int a_n, b_n; int i, j; int a[MAXNUM], b[MAXNUM]; int match[MAXNUM][MAXNUM]; int max_a2b[MAXNUM…
Crossed Matchings Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2711   Accepted: 1759 Description There are two rows of positive integer numbers. We can draw one line segment between any two equal numbers, with values r, if one of them…
题目链接:http://poj.org/problem?id=3286 题目大意: 输入n,m,求[n,m]的所有数字中,0出现的总数是多少,前导零不算. 解题思路: 模板题,设dp[pos][num],pos为数位,num为当前0的数目,然后套数位DP模板即可. 还有之前的一些思考: 关于数位DP求0时,dp下标记录num有什么作用,num不是与后面的0的个数无关吗?是的,在(!limit&&!lead)的情况下,前面有多少0是不影响后面可以出现多少0的.但是,比如说dp[pos][nu…
Description The cow bicycling team consists of N (1 <= N <= 20) cyclists. They wish to determine a race strategy which will get one of them across the finish line as fast as possible. Like everyone else, cows race bicycles in packs because that's th…
传送门: http://poj.org/problem?id=1949 Chores Time Limit: 3000MS   Memory Limit: 30000K Total Submissions: 6368   Accepted: 3013 Description Farmer John's family pitches in with the chores during milking, doing all the chores as quickly as possible. At…
id=3140">[POJ 3140] Contestants Division(树型dp) Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9121   Accepted: 2623 Description In the new ACM-ICPC Regional Contest, a special monitoring and submitting system will be set up, and stud…
Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4748   Accepted: 2078 Description Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually exp…
[题目链接] http://poj.org/problem?id=2686 [题目大意] 给出一张无向图,你有n张马车票每张车票可以租用ti匹马, 用一张马车票从一个城市到另一个城市所用的时间为这两个城市间的道路距离除以马的数量 一张马车票只能用一次,问从a到b的最短时间 [题解] dp[S][u]表示剩余的车票集合为S,到达u所用的最短时间, 之后我们枚举剩余的车票集合,枚举边和用的车票,进行状态转移. [代码] #include <cstdio> #include <climits&…