摘要:
简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>#include <algorithm>using namespace std;#define maxn 25#define maxl 100struct Candidate{ int num; int id;} can[maxn];int n, m;char name[maxn][maxl];char party[maxn][maxl];bool operator 阅读全文
posted @ 2011-09-08 19:55
undefined2024
阅读(130)
评论(0)
推荐(0)
摘要:
简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>#include <cmath>using namespace std;#define eps 1.0E-8double xx1,xx2,yy1,yy2;double dist(double x1, double y1, double x2, double y2){ double x = abs(x1 - x2); double y = abs(y1 - y2); r 阅读全文
posted @ 2011-09-08 19:03
undefined2024
阅读(145)
评论(0)
推荐(0)
摘要:
最小路径覆盖题意:不是赤裸裸的最小路径覆盖(走遍所有的点),正常的最小路径覆盖中两个人走的路径不能有重复的点,而本题可以重复。分析:我们仍可将问题转化为最小路径覆盖。如果一个人需要经过另一个人走过的点的时候,让他直接从该点上空飞过去,越过该点,直接走下一个点。如果我们赋予每个人这种能力,那么求得的无重复点的最小路径覆盖结果,就是题目要求的结果,因为需要重复的地方只要飞过去,就可以不重复了。赋予这个能力的方法就是把所有点能间接到达的点全都改为直接到达。然后正常求最小路径覆盖即可。View Code #include <iostream>#include <cstdlib> 阅读全文
posted @ 2011-09-08 18:46
undefined2024
阅读(682)
评论(0)
推荐(1)
摘要:
动态规划View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 105#define maxm 450#define inf 0x3f3f3f3fint n;int v[maxn];int f[maxn][maxn * maxm];int sum;int main(){ //freopen("t.txt", "r", stdin); s 阅读全文
posted @ 2011-09-08 15:56
undefined2024
阅读(301)
评论(0)
推荐(0)
摘要:
简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;int a, b, c;char st[50];int make(char *st){ int len = strlen(st); int ret = 0; for (int i = len - 1; i >= 0; i--) ret = ret * 10 + st[i] - '0'; return ret;}int 阅读全文
posted @ 2011-09-08 14:01
undefined2024
阅读(150)
评论(0)
推荐(0)