做了一个晚上的题目,晕了View Code #include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>using namespace std;const double eps=1e-9;#define zero(x) (((x)>0? (x):-(x))<eps)struct point{ double x,y;}a[1010];int n,s[1010];int top;int cmp(point a,point b){ if(a.y==b.y) re Read More
posted @ 2011-10-05 21:24 Because Of You Views(314) Comments(0) Diggs(0) Edit
还是太粗心了阿,求直线上的点到两点间距离和的最小值搞了好久阿,A点和B点有可能在直线的同侧也可能在异侧View Code #include<stdio.h>#include<math.h>const double eps = 1e-9;struct point{ double x,y;}A,B,C,A1,node;double dis(point a,point b){ return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}double cross(point a,point b,point c){ return ( Read More
posted @ 2011-10-05 16:52 Because Of You Views(316) Comments(0) Diggs(0) Edit
View Code #include<stdio.h>#include<stdlib.h>__int64 exgcd(__int64 a,__int64 b,__int64 &x,__int64 &y){ if(b==0) {x=1;y=0;return a;} else { __int64 d=exgcd(b,a%b,x,y); __int64 t=x; x=y; y=t-a/b*y; return d; }}int main(){ __int64 a,b,x,y; while(sca... Read More
posted @ 2011-10-05 02:01 Because Of You Views(196) Comments(0) Diggs(0) Edit