摘要: 题意:问n个点中可以组成多少个正方形,n<1000思路:一开始TLE了,是hash的边,后来看网上是hash的点,hash函数是(x*x+y*y)%prime已知正方形的两个点,求另外两个坐标:(x1,y1)、(x2,y2)则: x3=x1+(y1-y2) y3=y1-(x1-x2) x4=x2+(y1-y2) y4=y2-(x1-x2)View Code 1 #include<stdio.h> 2 #include<vector> 3 #include<string.h> 4 #include<iostream> 5 using name 阅读全文
posted @ 2013-05-01 20:21 _sunshine 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 题意:存不存在两片相同的雪花,每片六角形的雪花的每个角的长度给出,可能是顺时针也可能是逆时针给出。最多100 000片雪花。思路:将六角形的sum%prime之后存起来,雪花相同的前提是sum相同,sum相同再一一比较。View Code 1 #include<stdio.h> 2 #include<vector> 3 #include<string.h> 4 #include<iostream> 5 using namespace std; 6 7 const int N=100005; 8 const int prime=90001; 9 1 阅读全文
posted @ 2013-05-01 14:23 _sunshine 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 链接:http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1758题意:输入两个字符串S,T,长度小于100000,求出在S中包含T中的最小的那段,例如:S = "ADOBECODEBANC"T = "ABC"答案是 "BANC".View Code 1 #include<stdio.h> 2 #include<string.h> 3 const int M=10005; 4 const int N=1 阅读全文
posted @ 2013-05-01 13:37 _sunshine 阅读(237) 评论(0) 推荐(0) 编辑