hdu 1348【wall】
摘要:晕死,一个循环害死我了,改了好长时间一直WA,搞得我莫名其妙,真是百思不得其解,现在才发现时一个while写成了if,晕死~~~代码如下: 1 #include <cstdio> 2 #include <cmath> 3 #include <algorithm> 4 using namespace std; 5 6 const double pi = acos(-1.0); 7 struct node 8 { 9 int x,y;10 }p[1100],stack[1100];11 12 int n;13 double length;14 int top;1
阅读全文
posted @
2012-05-22 21:38
Shirlies
阅读(311)
推荐(0) 编辑
hdu 1147【Pick-up sticks】
摘要:判断线段相交问题,其实还以为会超时的,结果良好^_^代码如下: 1 #include <cstdio> 2 #include <cmath> 3 #include <algorithm> 4 5 struct point 6 { 7 double x,y; 8 }; 9 10 struct node11 {12 point aa,bb;13 }segment[100100];14 15 int n;16 int stack[100100];17 18 double cross_product(point &a,point &b,point &
阅读全文
posted @
2012-05-21 15:10
Shirlies
阅读(228)
推荐(1) 编辑
hdu 1577【WisKey的眼神】
摘要:代码如下: 1 #include <cstdio> 2 #include <cmath> 3 #include <algorithm> 4 5 void solve(); 6 int L,sx,sy,px,py; 7 8 int main() 9 {10 while(scanf("%d",&L),L)11 {12 scanf("%d%d%d%d",&sx,&sy,&px,&py);13 14 if(py > L || px > L || py < -L || p
阅读全文
posted @
2012-05-20 21:44
Shirlies
阅读(310)
推荐(0) 编辑
hdu 1392【Surround the Trees】
摘要:凸包代码如下: 1 #include <cstdio> 2 #include <algorithm> 3 #include <cstring> 4 #include <cmath> 5 using namespace std; 6 7 struct node 8 { 9 int x,y;10 }p[1000],stack[1000];11 int n,top;12 13 double dis(node &a,node &b)14 {15 return sqrt(1.0*(a.x - b.x) * (a.x - b.x) + 1.0
阅读全文
posted @
2012-05-20 21:35
Shirlies
阅读(172)
推荐(0) 编辑
poj 1696
摘要:不错的一题,需要极角排序,看了别人的代码做的。。。。。。计算几何啊~~~View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <algorithm> 5 6 const double er = 1e-8; 7 struct point 8 { 9 int index;10 int x,y;11 }p[100];12 int n;13 int res;14 15 int dis(point a,point b)16 {17 return sq
阅读全文
posted @
2012-04-12 10:43
Shirlies
阅读(247)
推荐(0) 编辑