上一页 1 2 3 4 5 6 7 ··· 15 下一页
摘要: 链接:http://acm.hdu.edu.cn/showproblem.php?pid=4631题意:依次给你n个点,每次求出当前点中的最近点对,输出所有最近点对的和;思路:按照x排序,然后用set维护,每次插入只更新当前点和插入点前后几个位置~ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 const int MAX=5e5+10; 9 typedef long long LL;10 LL ax, bx, cx, ay, by, cy;11 i... 阅读全文
posted @ 2013-07-31 20:44 淡墨æ末央 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 链接:http://acm.hdu.edu.cn/showproblem.php?pid=4613题意: 判断一个集合中的点能不能由另一个集合中的点,通过平移,旋转,放缩得到~思路:先求出集合中的点的凸包,然后枚举每一条边作为起点 ,看原集合中的点能否与要比较的集合中的点一一对应~ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std; 10 const int maxn = 25010; 11 ... 阅读全文
posted @ 2013-07-29 11:37 淡墨æ末央 阅读(409) 评论(0) 推荐(0) 编辑
摘要: 链接:http://poj.org/problem?id=2960 1 #include 2 #include 3 const int N = 10001; 4 const int M= 101; 5 int SG[N];//SG[i]记录一堆i颗石子的SG状态 6 int s[M];//存储可选取的石子数目集合 7 int k;//s[]集合中的元素个数 8 int mex(int x) 9 {10 if( SG[x]!=-1 )return SG[x];11 bool vi[N]={0};12 for( int i=0; i<k; ++ i ){13 ... 阅读全文
posted @ 2013-07-27 19:58 淡墨æ末央 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 链接: http://acm.hdu.edu.cn/showproblem.php?pid=4609题意: 给定 N 个正整数, 表示 N 条线段的长度, 问任取 3 条, 可以构成三角形的概率为多少~数据范围: N 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 typedef __int64 LL; 8 const double pi=acos(-1); 9 const int MAXN=3e5; 10 const double eps=1e-6; 11 struct C 12... 阅读全文
posted @ 2013-07-26 12:50 淡墨æ末央 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2533三个方向, 横,竖,对角线~ 1 #include 2 #include 3 using namespace std; 4 5 int main() 6 { 7 long long int n,m; 8 while(scanf("%lld%lld",&n,&m)!=EOF&&n&&m) 9 {10 if 阅读全文
posted @ 2013-07-22 17:15 淡墨æ末央 阅读(646) 评论(0) 推荐(0) 编辑
摘要: 链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2127题意: 圆心在原点,半径为 R 的圆,其边上有 N 个点, 任意三点组成一个三角形, 求三角形面积和~思路: 利用叉积求面积~暴力求三角形~ 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 const double Pi=acos(-1); 8 const 阅读全文
posted @ 2013-07-22 11:31 淡墨æ末央 阅读(322) 评论(0) 推荐(0) 编辑
摘要: 链接:http://poj.org/problem?id=2507题意:哪个直角三角形,一直角边重合, 斜边分别为 X, Y, 两斜边交点高为 C , 求重合的直角边长度~思路: 设两个三角形不重合的两条直角边长为 a , b,根据 三角形相似, 则有 1/a + 1/b =1/c, 二分枚举答案得之~ 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 double x, y, c; 8 const double eps=1e-8; 9 double get( double ... 阅读全文
posted @ 2013-07-22 10:18 淡墨æ末央 阅读(214) 评论(0) 推荐(0) 编辑
摘要: A. Flipping Game链接:http://codeforces.com/contest/327/problem/A题意:从i 到 j 翻转一次使得 1 的个数最多~直接暴力搞~ 1 #include 2 #include 3 #include 4 using namespace std; 5 int N; 6 int a[105], b[105]; 7 int main( ) 8 { 9 while(scanf("%d", &N)!= EOF){10 for(int i=0; it?ans:t;24 b[k]=a[... 阅读全文
posted @ 2013-07-18 15:23 淡墨æ末央 阅读(423) 评论(0) 推荐(0) 编辑
摘要: 链接:http://acm.hdu.edu.cn/showproblem.php?pid=2999题意:先给定可操作数的集合(有重复),每次操作必须拿集合中到数且是连续的, 不能操作为负;然后有M次询问, 每次总数为k的石头;思路: 通过求sg函数,枚举下一个状态,sg=0则为必败点, 数据量有点大, 要注意姿势,不然会 T;View Code 1 #include <cstring> 2 #include <cstdio> 3 #include <algorithm> 4 using namespace std; 5 int N, M, L, k; 6 i 阅读全文
posted @ 2013-05-01 14:32 淡墨æ末央 阅读(481) 评论(0) 推荐(0) 编辑
摘要: hdu 2869 Paper Cutting Game链接:http://acm.hdu.edu.cn/showproblem.php?pid=2869View Code 1 #include <iostream> 2 #include <cmath> 3 #include <cstring> 4 #include <cstdio> 5 #include <string> 6 #include <stdlib.h> 7 #include <algorithm> 8 using namespace std; 9 阅读全文
posted @ 2013-04-30 22:35 淡墨æ末央 阅读(171) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 15 下一页