摘要:
题意:给出一个正方形,每条边上有n个点,把这些点作为端点拉线组成的网格(整个正方形由一些四边行拼成),求最大格的面积。分析:计算几何,求出所有线的交点,分别计算每个格的面积。在求线段交点时可以用叉积面积的方式,求ac,bd交点:void intersection(Point &a, Point &b, Point &c, Point &d, Point &ret){ double s1 = xmulti(a, c, b); double s2 = xmulti(a, c, d); ret.x = (s1 * d.x - s2 * b.x) / (s1 - 阅读全文
posted @ 2011-07-04 17:55
undefined2024
阅读(202)
评论(0)
推荐(0)
摘要:
题意:给一组小括号与中括号的序列,添加最少的字符,使该序列变为合法序列,输出该合法序列。分析:dp,f[i][j]表示从i位到j位的序列变为合法序列最少添加多少个字符。如果匹配st[s]与st[e]匹配,那么f[s][e] = f[s + 1][e - 1];否则f[s][e] = f[s][k] + f[k + 1][e];我们还要用v[][]记录每个f[s][e]是从哪得来的。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>us 阅读全文
posted @ 2011-07-04 16:41
undefined2024
阅读(1451)
评论(0)
推荐(0)
摘要:
简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <algorithm>using namespace std;#define maxn 705#define eps 10E-9struct Point{ int x, y;} point[maxn];struct Node{ double k; int a, b;} f[maxn * maxn];int 阅读全文
posted @ 2011-07-04 10:28
undefined2024
阅读(273)
评论(0)
推荐(0)

浙公网安备 33010602011771号