redbook
文章平均质量分 84
utoppia
这个作者很懒,什么都没留下…
展开
-
Uva 10288 - Coupons
自己写的正数分数类,也作为红书第一题,留念。。。alpc 加油。#include#include#include#include#include#includeusing namespace std;#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)#define nMax 1010#define inf 0x原创 2013-04-15 00:26:16 · 759 阅读 · 0 评论 -
Ural 1046 Geometrical Dreams
Link To The ProblemSokution : 用复数类可以使问题大大简化Code:#include#include#include#include#include#include#include#include#includeusing namespace std;#define nMax 300#define LL long原创 2013-10-22 01:18:41 · 879 阅读 · 0 评论 -
Ural 1052
#include#include#include#include#include#includeusing namespace std;#define nMax 500#define LL long longtypedef pair point ;#define x first#define y seconddouble const eps = 1e-9;int原创 2013-10-22 14:08:59 · 675 阅读 · 0 评论 -
Ural 1030. Titanic
Link To The ProblemCode:#include#include#include#include#include#include#include#includeusing namespace std;#define nMax 300#define LL long long#define rep(i,b,n) for(int原创 2013-10-21 19:16:04 · 603 阅读 · 0 评论 -
WF 2008 (UVaLive4127 ) - The Sky is the Limit
Link To The ProblemSolution : 离散,模拟Code :// WF 2007 The Sky is the limit// Solution : 离散#include#include#include#include#include#include#includeusing namespace std;#defin原创 2013-10-21 23:59:22 · 799 阅读 · 0 评论 -
SGU 227. The art to the broad masses!
Link To The ProblemSolution : 圆交、点在弧上的判断PS: SGU 的数据真真有点恶心,一开始完全没有意识到还有重合的情况啊。。Code:// SGU 227 The art to thr broad masses// Solution :圆交、点在弧上的判断、// 两弧相交的结果是,一个点、两个点、一段弧、没有//#in原创 2013-10-22 09:54:39 · 698 阅读 · 0 评论 -
UVa 11265 The Sultan's Problem
Link To The ProblemSolution : 半平面交、多边形面积Code:// UVa 11265 The Sultan's Problem// HalfPlane Intersection//#include#include#include#include#include#include#include#includeus原创 2013-10-22 10:33:40 · 726 阅读 · 0 评论 -
SGU 253. Theodore Roosevelt
Link To The ProblemSolution : 三角剖分、二分、极角排序Code://SGU 253 Theodore Roosevelt//Solution : 三角剖分、二分#include#include#include#include#include#include#includeusing namespace std;#原创 2013-10-22 11:14:27 · 783 阅读 · 0 评论 -
SGU 446. Rotation Estimation
Link To The ProblemSolution : 枚举旋转的角度、注意精度,开到1e-6就行了,太大了可能出错Code:// SGU 446 Rotation Estimation// 枚举、凸包、旋转#include#include#include#include#include#include#includeusing names原创 2013-10-22 13:16:12 · 751 阅读 · 0 评论 -
Beijing 2004 (UVaLive 3137) - Square
Link To The ProblemSolution : 构造、点到线段的最短距离Code:// Beijing 2004 Square// Solution : 构造//#include#include#include#include#include#include#includeusing namespace std;#define原创 2013-10-22 11:50:31 · 641 阅读 · 0 评论 -
CERC 1999 (SPOJ 40) Lifting the Stone
Link To The ProblemSolution : 多边形的重心PS : POJ 神数据就是过不掉,SPOJ上1A.。。(尴尬。。。)Code: // CERC 1999 Lifting The Stone// Solution : 多边形的重心//#include #include #include #include #include原创 2013-10-23 00:00:34 · 895 阅读 · 0 评论 -
SGU 283. Mechanics
Link To The ProblemSolution : 先判断是否碰撞、然后模拟。Code:// SGU 283 Mechanics// Solution : 模拟//#include#include#include#include#include#include#includeusing namespace std;#define F原创 2013-10-22 23:03:08 · 673 阅读 · 0 评论 -
Amritapuri 2009 (UValive 4676 ) - Geometry Problem
Link To The ProblemSolution : 由于x的范围是10e7,平方的话是10e14,double 的精度可能判不到小的eps。所以在做叉积或者点积做判断的时候注意取方向向量就好。。。否则。。。WA。。。Code :// Amritapuri 2009 Geometry Problem// Solution : 模拟//#include原创 2013-10-23 01:54:07 · 1109 阅读 · 0 评论 -
Shanghai 2004(UVaLive 3263) - That Nice Euler Circuit
Link To The ProblemSolution : 离散化,欧拉平面公式: V - E + F = 2// Shanghai 2004 That Nice Euler Circuit// Solution : #include#include#include#include#include#include#includeusing namespac原创 2013-10-22 01:09:37 · 824 阅读 · 0 评论 -
Uva 10792 The Laurel-Hardy Story
Link To The ProblemSolution : Math Code:// UVa 10792 The Laurel Hardy Story// Math#include#include#include#include#include#include#includeusing namespace std;#define FOR(i原创 2013-10-21 19:30:59 · 726 阅读 · 0 评论 -
UVa 10794 The Deadly Olympic Returns!!!
Link To The ProblemSolution : 数学,计算Code://UVa 10794// | a-b |^2 = |a|^2 + |b|^2 + 2*(a*b) #include#include#include#include#include#includeusing namespace std;#define dbg(x)原创 2013-10-22 08:39:35 · 781 阅读 · 0 评论 -
CERC_2008_Tower(hdu 2971)
PRO IS HERE由 a(n) = 2*a(2)*a(n-1) - a(n-2)let p = 2*a(2);==>a(n) =p*a(n-1) - a(n-2)==>a(n)^2 = p^2*a(n-1)^2 - 2*p*a(n-1)*a(n-2) + a(n-2)^2................(1)let s(n) =sum(a(i) );s原创 2013-04-16 20:51:27 · 853 阅读 · 0 评论 -
SGU_271_Book_Pile
PRO IS HERE双端队列模拟过程即可,很像2013华中网络预赛的某题。。。好像是D#include#include#include#include#include#include#include#includeusing namespace std;#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)原创 2013-04-19 21:08:02 · 614 阅读 · 0 评论 -
NEERC 2005 Feel Good (Poj2976)
PRO IS HEREa[i] 最小的区间是固定的,可以用一个栈啊什么的求出左右比之小的第一个数的位置,而后就是模拟,但是我的代码过不了LA上HERE不知到时为什么。‘代码:#include#include#include#include#include#include#includeusing namespace std;#define原创 2013-04-19 21:46:13 · 1050 阅读 · 0 评论 -
Ural 1003 Parity
PRO IS HERE大意:一段长度为n的路,已知m对信息,信息告诉你某两点之间的距离的奇偶,问你到哪个信息是错的。解答:明显的并查集,保存距离的奇偶,find的时候顺便跟新一下。。。我就是忘记了fa[x] = k查了n久的代码啊,弱菜就是弱啊。。。#include#include#include#include#include#i原创 2013-04-21 23:24:15 · 695 阅读 · 0 评论 -
UVa 11189 A Simple Pendulum
Link To The Problem久 WA 必 AC。。。知识点: 多边形重心、圆和线段的交、点到线段距离、点在线段的投影等基本知识。Code:#include#include#include#include#include#includeusing namespace std;#define FOR(i,a,b) for(int (i)=(原创 2013-10-17 11:48:40 · 700 阅读 · 0 评论 -
NEERC 2008 Aerodynamics
Link To The Problem转化成2维的凸包// 3D截面 + 2D凸包 #include#include#include#include#include#includeusing namespace std;#define nMax 110#define sf scanf#define pf printf#define rep原创 2013-10-17 12:20:59 · 781 阅读 · 0 评论 -
Shanghai 2004 ( UVALive 3259) Amphiphilic Carbon Molecules
Link To The Problem采用了枚举加扫描的方法,注意极角排序的方式。知识点 : 极角,叉积Code:// ShangHai 2004 (UValive 3529)// 知识点:极角排序,叉积#include#include#include#include#include#includeusing namespace原创 2013-10-17 15:20:31 · 641 阅读 · 0 评论 -
NEERC 2009 ( UValive 4589) Asteroids
Link To The Problem求凸包,重心,然后分别求重心到面的最短距离,相加即可。//重心,三维凸包#include#include#include#include#include#includeusing namespace std;#define dbg(x) cout << __LINE__ << ": " << #x << " = "原创 2013-10-17 15:37:11 · 781 阅读 · 0 评论 -
WF 2007 (UVaLive 2397) - Collecting Luggage
Link To The Problem知识点: 二分,最短路,线段和多边形判交Code:// WF 2007 (UValive 2397 Collecting Luggage// 知识点:二分,最短路,线段和多边形判交#include#include#include#include#include#include#includeusing na原创 2013-10-18 11:18:17 · 2881 阅读 · 0 评论 -
Ural 1043
//知识点:基本计算几何#include#include#include#include#include#include#include#includeusing namespace std;#define nMax 300#define LL long long#define rep(i,b,n) for(int (i)=(b);(i)<(n);(i)原创 2013-10-18 12:09:44 · 549 阅读 · 0 评论 -
ZOJ 3226 Mobile Positioning
Link To The ProblemSolution : Step 1 : 求出B点的坐标(注意时间可能为0)Step 2 : 求出A点的坐标PS:一定要注意所有可能的情况。。。极其猥琐。。。Code : // ZOJ 3226 Mobile Positioning// Geometry & Math Calculate#include原创 2013-10-24 16:31:56 · 845 阅读 · 0 评论 -
SGU 110. Dungeon
Link To The Problem知识点: 三维 直线和球的交、向量旋转Code:// SGU 110 Dungeon// 三维直线和圆的交、向量旋转#include#include#include#include#include#includeusing namespace std;#define nMax 10010#define原创 2013-10-18 17:06:31 · 677 阅读 · 0 评论 -
SGU 244. Height, Bisector and Median
Link To The ProblemSolution : 二分、二分a的长度,然后根据l,h计算出角平分线的长度,判断即可。。。Code: // SGU 244 Height Bisector and Median// Solution : Math Calculate//#include#include#include#include#inclu原创 2013-10-24 00:10:49 · 946 阅读 · 0 评论