博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年7月16日

摘要: 题目:http://poj.org/problem?id=3167题意:给一个模式串,按照模式串的大小对应关系,找出匹配串有相同大小对应关系的子串。利用指针,下标可以直接一一对应。View Code #include <cstdio>#include <cstring>#include <vector>using namespace std;const int N = 100000+10;const int M = 25000+10;int n, k, s, at;int a[N], b[M];int d[30], low[M], high[M], path 阅读全文

posted @ 2012-07-16 11:40 紫华弦筝 阅读(204) 评论(0) 推荐(0) 编辑

2012年7月15日

摘要: 题目:http://livearchive.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2658ac自动机。先把单词按照题意排序,把询问串建成trie树,然后按照单词顺序进行查询,注意好结果保存,询问串可能会有重复。View Code #include <cstdio>#include <cstring>#include <string>#include <vector>#include <io 阅读全文

posted @ 2012-07-15 12:12 紫华弦筝 阅读(156) 评论(0) 推荐(0) 编辑

2012年7月14日

摘要: 题目:http://poj.org/problem?id=2493View Code #include <iostream>#include <sstream>#include <cstdio>#include <map>#include <algorithm>using namespace std;const int N = 10000+10;char str[N];int main(){ //freopen("D:/a.txt", "r", stdin); int T, n, m, cas= 阅读全文

posted @ 2012-07-14 19:02 紫华弦筝 阅读(144) 评论(0) 推荐(0) 编辑

摘要: 题目:http://poj.org/problem?id=3261第一道后缀数组。二分答案,然后遍历height数组,判断该答案是否出现次数大于k次。View Code #include <cstdio>#include <cstring>#include <map>using namespace std;const int N = 1000000+10;int ua[N], ub[N], us[N], n, m, arr[N], sa[N], t, cnt;int cmp(int *r,int a,int b,int l){ return r[a]==r[ 阅读全文

posted @ 2012-07-14 14:52 紫华弦筝 阅读(102) 评论(0) 推荐(0) 编辑

2012年7月12日

摘要: 题目:http://poj.org/problem?id=2600复数旋转+模拟退火。一开始还被复数吓到了(没学过啊),查了一下,跟坐标旋转很像啊。。。View Code #include <cstdio>#include <cmath>#include <algorithm>#define dis(a,b) sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y))using namespace std;const double pi = acos(-1.0);const double eps = 1e-8;struct n 阅读全文

posted @ 2012-07-12 19:40 紫华弦筝 阅读(168) 评论(0) 推荐(0) 编辑

摘要: 题目:http://poj.org/problem?id=3580View Code #include <iostream>#include <cstdio>#include <cstring>using namespace std;const int M = 300000+10;const int inf = 0x3f3f3f3f;#define type intstruct node{ int size, rev; type key, minv, delta; node *ch[2], *pre; void add(type v) { if (s... 阅读全文

posted @ 2012-07-12 18:48 紫华弦筝 阅读(143) 评论(0) 推荐(0) 编辑

摘要: 题目:http://poj.org/problem?id=3285题意:求一个与三个圆的角直径都相等并且最大的点的位置。即为求一个点,使这个点到三个圆的距离与该圆的距离之比相等。用方差的方法来进行评估随机化的结果。然后注意要确保点在范围内。View Code #include <cstdio>#include <cstdlib>#include <cmath>#include <ctime>#include <algorithm>#define dis(a,b) sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*( 阅读全文

posted @ 2012-07-12 17:35 紫华弦筝 阅读(235) 评论(0) 推荐(0) 编辑

摘要: 题目:http://poj.org/problem?id=3301View Code #include <cstdio>#include <cmath>#include <cstring>#include <algorithm>using namespace std;const double M = 1e99;const double pi = acos(-1.0);const double eps = 1e-8;struct node{ double x, y; void get(){ scanf("%lf%lf", &am 阅读全文

posted @ 2012-07-12 13:55 紫华弦筝 阅读(154) 评论(0) 推荐(0) 编辑

2012年7月11日

摘要: 题目:http://poj.org/problem?id=3608View Code #include <stdio.h>#include <math.h>#include <string.h>#include <algorithm>#define clr(a,b) memset(a,b,sizeof(a))#define sqr(x) ((x)*(x))using namespace std;const double eps = 1e-8;const double pi = acos(-1.0);const int inf = 0x3f3f3f 阅读全文

posted @ 2012-07-11 18:45 紫华弦筝 阅读(125) 评论(0) 推荐(0) 编辑

摘要: 题目:http://poj.org/problem?id=2187View Code #include <iostream>#include <cstdio>#include <math.h>#include <cstring>#include <algorithm>#define sqr(x) ((x)*(x))using namespace std;const double eps = 1e-8;const int pi = acos(-1.0);const int N = 500000+10;int dcmp(double x) 阅读全文

posted @ 2012-07-11 18:37 紫华弦筝 阅读(132) 评论(0) 推荐(0) 编辑