上一页 1 ··· 67 68 69 70 71 72 73 74 75 ··· 182 下一页
摘要: 暴力枚举View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 10int n;int f[maxn][maxn];int shift[maxn];void input(){ for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) scanf("%d", &f[i][j]);}bo 阅读全文
posted @ 2011-10-01 15:58 undefined2024 阅读(245) 评论(0) 推荐(0)
摘要: 题意:给定一些点的坐标(hi,wi),要选出一个点集,使得集合所包含的点数最多,且符合A*(H-h) + B*(W-w) <= C,h为集合中最小h,w为点集中最小w。分析:我们是要找到这样的点集,hi>=h,wi>=w,A*(hi-h) + B*(wi-w) <= C。根据线性规划知识,这些点都在一个直角三角形内,两条直角边长度为cw=C/A,ch=C/B。我们的问题转化为用这样一个三角形最多能框住多少点,且根据题意w,h为点集坐标最小值,即三角形两条直角边上都要有点。我们的做法是,枚举n个点,对于每个点,先使其处于三角形的直角顶点(左下角),然后向下平移三角形框,每 阅读全文
posted @ 2011-10-01 15:40 undefined2024 阅读(660) 评论(0) 推荐(0)
摘要: 模拟View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;char st[100];bool vis[300];int main(){ //freopen("t.txt", "r", stdin); bool first = true; memset(vis, 0, sizeof(vis)); vis['A'] = true; vis[' 阅读全文
posted @ 2011-09-30 18:36 undefined2024 阅读(201) 评论(0) 推荐(0)
摘要: 模拟题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxl 1005char st[maxl];char ans[maxl];void work(){ int len = strlen(st); int i = 0; int l = 0; int r; while (l < len) { r = l + 1; if (r < len && st[ 阅读全文
posted @ 2011-09-30 17:54 undefined2024 阅读(182) 评论(0) 推荐(0)
摘要: 最小生成树View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>#include <algorithm>#include <cmath>using namespace std;#define maxn 800#define maxm 1000struct Point{ int x, y;}point[maxn];struct Edge{ int a, b;}edge[maxn * maxn];int n, m;in 阅读全文
posted @ 2011-09-30 17:10 undefined2024 阅读(562) 评论(0) 推荐(0)
上一页 1 ··· 67 68 69 70 71 72 73 74 75 ··· 182 下一页