2012年6月9日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1905水题,套个米勒拉宾的模板就秒了View Code #include <stdio.h>__int64 qpow(int a,int b,int r)//快速幂 { __int64 ans=1,buff=a; while(b) { if(b&1)ans=(ans*buff)%r; buff=(buff*buff)%r; b>>=1; } return ans;}bool Miller_Rabbin(int n,int a)//米勒拉宾... 阅读全文
posted @ 2012-06-09 16:54 LegendaryAC 阅读(191) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1140根据球的切点做简单的判断,一开始找到答案没有跳出循环,各种错。。。View Code #include <iostream>#include <cmath>using namespace std ;const double PI=acos(-1.0) ;//π的表示方法 struct point { double x,y,z ;} ;double dis(point p1,point p2){ return sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p 阅读全文
posted @ 2012-06-09 05:49 LegendaryAC 阅读(189) 评论(0) 推荐(0) 编辑
 
摘要: struct point{ double x,y ;} ;double direction(point p1,point p2,point p){ return (p.x-p1.x)*(p1.y-p2.y)-(p1.x-p2.x)*(p.y-p1.y) ;}bool online(point p1,point p2,point p){ return (p.x=min(p1.x,p2.x) && p.y=min(p1.y,p2.y)) ;}bool intersect(point p1,point p2,point p3,point p4){ double d1=dire... 阅读全文
posted @ 2012-06-09 03:45 LegendaryAC 阅读(144) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1086判断两线段是否相交,用向量搞了View Code #include <iostream>using namespace std ;struct point{ double x,y ;} ;typedef struct L{ point p1,p2 ;}L ;L kk[110] ;double direction(point p1,point p2,point p){ return (p.x-p1.x)*(p1.y-p2.y)-(p1.x-p2.x)*(p.y-p1.y) ;}bool ... 阅读全文
posted @ 2012-06-09 03:41 LegendaryAC 阅读(179) 评论(0) 推荐(0) 编辑