08 2014 档案

摘要:把涂色的格子按对称旋转至左上角。当未涂色时,若要符合要求,则必须要求每一圈矩形都是上下左右对称的。注意是一圈的小矩形。对于N*N的阵,若最外层一圈的小矩形要符合要求,则(假设N%2==0)可以涂色的种数为K^(N/2)种。全个矩阵可涂色数为K^(N/2)*(N/2+1)/2。接第一段,(N/2)*(... 阅读全文
posted @ 2014-08-31 21:55 chenjunjie1994 阅读(180) 评论(0) 推荐(0) 编辑
摘要:不知道哪里错了,测试了几十组数据均正确。。。可以找出规律,指数的增长是兔子数列。这个数列,是可以用矩阵快速幂得到的,见POJ 3070然后,竟然有一条公式:A^B%C = A^(B%phi(C)+phi(C))%C然后就可以求解了#include #include #include #include... 阅读全文
posted @ 2014-08-31 21:09 chenjunjie1994 阅读(194) 评论(0) 推荐(0) 编辑
摘要://回宿舍去了,明天做点难一点的题,今天做的都很水,感觉。没意思。#include #include using namespace std;const __int64 MOD=10; __int64 Power(__int64 a,__int64 b,__int64 m){ a%=m; __... 阅读全文
posted @ 2014-08-30 22:12 chenjunjie1994 阅读(110) 评论(0) 推荐(0) 编辑
摘要:#include #include #include #include using namespace std; int n,M=9973;struct Matrax { int m[15][15];}; Matrax a,per; void initial(){ int i,j; ... 阅读全文
posted @ 2014-08-30 22:08 chenjunjie1994 阅读(130) 评论(0) 推荐(0) 编辑
摘要:#include #include using namespace std;const __int64 MOD=200907;__int64 Power(__int64 a,__int64 b,__int64 m){ a%=m; __int64 ans=1; while(b){ if(b&1){ ... 阅读全文
posted @ 2014-08-30 22:01 chenjunjie1994 阅读(140) 评论(0) 推荐(0) 编辑
摘要:找规律吧。可以快速幂模#include #include using namespace std;__int64 Power(__int64 a,__int64 b,__int64 k){ __int64 ans=1; a%=k; while(b){ if(b&1){ ans=ans*a%k;... 阅读全文
posted @ 2014-08-30 21:47 chenjunjie1994 阅读(170) 评论(0) 推荐(0) 编辑
摘要:水题,结果MOD 10000#include #include using namespace std;int n=2,M=10000;struct Matrax { int m[35][35];}; Matrax a,per; void initial(){ int i,j; f... 阅读全文
posted @ 2014-08-30 21:02 chenjunjie1994 阅读(168) 评论(0) 推荐(0) 编辑
摘要:简单的快速幂取模题但要注意由于a可能很大,相乘会超范围,所以乘前要先模#include #include using namespace std;int quick(int a,int b,int m){ int ans=1; a%=m; while(b){ if(b&1){ ans=(ans... 阅读全文
posted @ 2014-08-30 20:53 chenjunjie1994 阅读(256) 评论(0) 推荐(0) 编辑
摘要:二分二分二分。。记录二分的点。1600多MS,应该 可以再优化#include #include #include #include using namespace std;int stack[150],sp;int n,M;struct Matrax { int m[35][35];};Matra... 阅读全文
posted @ 2014-08-30 16:48 chenjunjie1994 阅读(185) 评论(0) 推荐(0) 编辑
摘要:特判B不能大于等于C高次同余方程#include #include #include #include #include using namespace std;const int Maxn=65535;struct hash{ int a,b,next;}Hash[Maxn*2];int flag... 阅读全文
posted @ 2014-08-30 14:59 chenjunjie1994 阅读(267) 评论(0) 推荐(0) 编辑
摘要:高次同余方程。 BL == N (mod P)求解最小的L。由于数据范围很大,暴力不行这里用到baby_step,giant_step算法。意为先小步,后大步。令L=i*m+j (m=ceil(sqrt(p-1))),那么原式化为 B^(i*m)*B^j==N(MOD P)————》B^j===N*... 阅读全文
posted @ 2014-08-30 14:55 chenjunjie1994 阅读(204) 评论(0) 推荐(0) 编辑
摘要:Babystep算法。具体为什么,我也不太明白,好像资料不多。#include #include #include #include #include using namespace std;const int Maxn=65535;struct hash{ int a,b,next;}Hash[M... 阅读全文
posted @ 2014-08-30 14:07 chenjunjie1994 阅读(209) 评论(0) 推荐(0) 编辑
摘要:#include #include #include #include using namespace std;const int MaxM=11;int a[MaxM],b[MaxM];void exgcd(int a,int b,int &d,int &x,int &y){ if(b==0){ ... 阅读全文
posted @ 2014-08-29 20:49 chenjunjie1994 阅读(122) 评论(0) 推荐(0) 编辑
摘要:特判r1=0时的情况,因为0是不能模的。#include #include #include #include using namespace std;const int MaxM=11;int a[MaxM],b[MaxM];void exgcd(int a,int b,int &d,int &x... 阅读全文
posted @ 2014-08-29 20:43 chenjunjie1994 阅读(161) 评论(0) 推荐(0) 编辑
摘要:和POJ 1061一样要求最小解,就尽可能的把ax的值附到by上去,所以可以有ax=b*k+a*v(因为附到by上后必须仍上a*x的形式)。两边同除a就可得到结果。但是,我们知道,(a,b)=1。所以k|a,也就是说,ans=(x%b+b)%b。后来加上b是为了防止负数。#include #incl... 阅读全文
posted @ 2014-08-29 19:41 chenjunjie1994 阅读(193) 评论(0) 推荐(0) 编辑
摘要:线性同余方程组,模板了。但要注意读完数据才跳出循环啊#include #include #include #include using namespace std;void exgcd(__int64 a,__int64 b,__int64 &d,__int64 &xx,__int64 &yy){ ... 阅读全文
posted @ 2014-08-29 16:20 chenjunjie1994 阅读(140) 评论(0) 推荐(0) 编辑
摘要:#include #include #include using namespace std;int main(){ int a,b; while(scanf("%d%d",&a,&b)!=EOF){ if(!a&&!b) break; int ans=1; for(int i=1;i<=b;... 阅读全文
posted @ 2014-08-29 15:13 chenjunjie1994 阅读(83) 评论(0) 推荐(0) 编辑
摘要:注释掉那段会超时,呃。。#include #include #include #include #include using namespace std;const int Max=1000000;bool val[Max+1];int p[350];int main(){ int t,n; sca... 阅读全文
posted @ 2014-08-29 15:06 chenjunjie1994 阅读(115) 评论(0) 推荐(0) 编辑
摘要:由算术基本定理,直接使用公式就好#include #include #include #include using namespace std;const int Maxp=1000;bool isprime[Maxp];int prime[Maxp],nprime;void Doprime(){ ... 阅读全文
posted @ 2014-08-29 10:11 chenjunjie1994 阅读(158) 评论(0) 推荐(0) 编辑
摘要:很容易由算术基本定理知道,完全平方数就是所有质因子指数为偶数的数。而求得N以下的质因子,可由前两篇的公式知,由N!与p的关系求得。对于指数为p的,用N!除去就可以,因为p必定属于N以内,且无重复。至于除法,在下实在不会,学得别人的,记录一下。MOD数除法,可以由费马小定理a^(p-1)=1 (mod... 阅读全文
posted @ 2014-08-29 09:19 chenjunjie1994 阅读(200) 评论(0) 推荐(0) 编辑
摘要:只会打表#include #include #include #include using namespace std;int main(){int Mec[10] = { 11, 23, 29, 37, 41, 43, 47, 53, 59 }; char st[10][100] = ... 阅读全文
posted @ 2014-08-28 15:46 chenjunjie1994 阅读(137) 评论(0) 推荐(0) 编辑
摘要:一道好题。由算术基本定理,知:那么,对于上式的每个因子值只能是2^M的形式。取第一个式子为例,通过分解因式出(1+p^2)=2^k知,a只能为1.于是对于p只能是梅森素数。而且每个梅森素数只能出现一次,利用这个就可以求解了,#include #include #include #include us... 阅读全文
posted @ 2014-08-28 14:35 chenjunjie1994 阅读(193) 评论(0) 推荐(0) 编辑
摘要:和上一题一样,注意除不尽为0#include #include #include #include using namespace std;long long n,p;int main(){ int t; scanf("%d",&t); while(t--){ scanf("%lld%lld",&... 阅读全文
posted @ 2014-08-28 09:46 chenjunjie1994 阅读(158) 评论(0) 推荐(0) 编辑
摘要:其实一道公式题:n!中素数i的幂为:[n/i]+[n/i^2]+[n/i^3]+[n/i^4]+......#include #include #include using namespace std;long long n;int main(){ long long two,five; int t... 阅读全文
posted @ 2014-08-28 09:19 chenjunjie1994 阅读(122) 评论(0) 推荐(0) 编辑
摘要:YEAH DONG DONG终于过了。这样思考,首先,要把所有素数求出来是不可能的。注意到L,R的差仅一百万,那么就可以只求这个范围内的素数了。而筛选范围内的素数,就可以用上一篇的方法,使用若n为合数,则必有素因子在sqrt(n)中。在筛选范围内的素数2了一次,直接判断每个数是否素数,TLE。。。#... 阅读全文
posted @ 2014-08-27 23:38 chenjunjie1994 阅读(140) 评论(0) 推荐(0) 编辑
摘要:n最大为2000000000(不知为什么OJ上是1000),若为判断2000000000是素数,则必有一个素数在sqrt(n)内,求出这个范围 的所有素数,其比最大数据小的n'的sqrt(n')也在这个范围 内。#include #include #include #include #include... 阅读全文
posted @ 2014-08-27 20:47 chenjunjie1994 阅读(203) 评论(0) 推荐(0) 编辑
摘要:水,用来熟悉内容#include #include #include #include #include using namespace std;const int Max=10050;bool prime[Max+10];int main(){ memset(prime,true,sizeof(p... 阅读全文
posted @ 2014-08-27 20:26 chenjunjie1994 阅读(119) 评论(0) 推荐(0) 编辑
摘要:其实就是筛选素数。如,若能被2是质数,则2的倍数全是合数。如此循环。#include #include #include #include #include using namespace std;const int Max=(1<<24);bool prime[Max+10];bool judge... 阅读全文
posted @ 2014-08-27 19:56 chenjunjie1994 阅读(186) 评论(0) 推荐(0) 编辑
摘要:可以用素数定理来解决。素数定理:小于n的素数个数记为p(n),则随着n的增长,p(n)/(n/ln(n))=1。#include #include #include #include using namespace std;int main(){ double n; while(scanf("%lf... 阅读全文
posted @ 2014-08-27 19:25 chenjunjie1994 阅读(184) 评论(0) 推荐(0) 编辑
摘要:其实同POJ 1061#include #include #include #include using namespace std;long long gcd(long long a,long long b){ if(b==0) return a; return gcd(b,a%b);}void... 阅读全文
posted @ 2014-08-27 15:17 chenjunjie1994 阅读(151) 评论(0) 推荐(0) 编辑
摘要:胡乱写一下,竟然是一次同余方程的内容。设a=n-m; b=L; d=x-y; 得ax+by=d然后,根定理,方程有解必须gcd(a,b)|d。确定有解后,两边除以gcd(a,b); 此时gcd(a',b')=1;使用EXGCD求出为1的解后再乘上d/gcd(a,b)。但要求最小解,就尽可能的把ax的... 阅读全文
posted @ 2014-08-27 14:46 chenjunjie1994 阅读(115) 评论(0) 推荐(0) 编辑
摘要:水#include #include #include using namespace std;long long gcd(long long a,long long b){ if(b==0) return a; return gcd(b,a%b);}int main(){ long long a,... 阅读全文
posted @ 2014-08-27 09:55 chenjunjie1994 阅读(164) 评论(0) 推荐(0) 编辑
摘要:刚开始,做了水题#include #include #include using namespace std;int main(){ int n; int a31,a32,a41,a42,a121,a122,ans3,ans4,ans12; while(scanf("%d",&n)!=EOF){ ... 阅读全文
posted @ 2014-08-27 09:38 chenjunjie1994 阅读(226) 评论(0) 推荐(0) 编辑
摘要:直接枚举就可以了。#include #include #include #include using namespace std;int a,b;vector ans;int main(){ while(scanf("%d%d",&a,&b)!=EOF){ if(a==0&&b==0) break... 阅读全文
posted @ 2014-08-27 09:25 chenjunjie1994 阅读(123) 评论(0) 推荐(0) 编辑
摘要:最小生成树#include #include #include #include #include using namespace std;const int Maxn=110;struct Pex{ double x,y,z; double r;};Pex pt[Maxn];int n;doubl... 阅读全文
posted @ 2014-08-26 20:20 chenjunjie1994 阅读(160) 评论(0) 推荐(0) 编辑
摘要:DLX的题,做过这题才算是会吧。这道题转化成了精确覆盖模型来做,一开始,只是单纯的要覆盖完行列和斜线,WA。后来醒悟了,不能这样,只要覆盖全部行或列即可。虽然如此,但某些细节地方很关键不能考虑到。特别要注意的是for(int i=R[c];i;i=R[i]){ if(i>ne) break; if(... 阅读全文
posted @ 2014-08-26 19:38 chenjunjie1994 阅读(314) 评论(0) 推荐(0) 编辑
摘要:精确覆盖#include #include #include #include #include using namespace std;const int maxn=920;const int maxnode=920*550;const int maxr=550;int ans;struct DL... 阅读全文
posted @ 2014-08-26 09:23 chenjunjie1994 阅读(236) 评论(0) 推荐(0) 编辑
摘要:WA了好久,第一次用重覆盖的模型做题。感觉这题有个陷阱,那就是当去掉某些边后,若因为这个边去掉而被破环的正方形还存在,那么就会造成覆盖不完全,WA.所以,在去掉边后,必定有些正方形是不存在的,须重新计算。另外,计算一个正方形有哪些边也很困难。#include #include #include #i... 阅读全文
posted @ 2014-08-26 00:03 chenjunjie1994 阅读(176) 评论(0) 推荐(0) 编辑
摘要:同上题#include #include #include #include #include #include using namespace std;int puzzle[10][10];char tmp[100];const int SLOT=0;const int ROW=1;const i... 阅读全文
posted @ 2014-08-25 11:14 chenjunjie1994 阅读(166) 评论(0) 推荐(0) 编辑
摘要:9阶数独,如上题做#include #include #include #include #include #include using namespace std;int puzzle[10][10];char tmp[15];const int SLOT=0;const int ROW=1;co... 阅读全文
posted @ 2014-08-25 10:41 chenjunjie1994 阅读(151) 评论(0) 推荐(0) 编辑
摘要:DLX算法,刚接触,是关于精确覆盖的,白书上有算法介绍。代码模板#include #include #include #include #include #include using namespace std;char puzzle[20][20];const int SLOT=0;const i... 阅读全文
posted @ 2014-08-25 09:57 chenjunjie1994 阅读(247) 评论(0) 推荐(0) 编辑
摘要:简单DP题。可以用运算符重载来写,简单一些。#include #include #include #include using namespace std;class STRS{public: char str[100]; void operator=(STRS b){ strcpy(str,b.... 阅读全文
posted @ 2014-08-23 11:28 chenjunjie1994 阅读(255) 评论(0) 推荐(0) 编辑
摘要:二维树状数组可解此题#include #include #include #include #define lowbit(x) (x)&(-x)using namespace std;int sum[105][105],k,n,m;int W,H;void gp(int x,int y){ int ... 阅读全文
posted @ 2014-08-23 10:10 chenjunjie1994 阅读(192) 评论(0) 推荐(0) 编辑
摘要:模拟退火算法。。。。这道题,呃。我怎么感觉他就是随机的。同一个代码,时而AC,时而WA。其实还真的是随机的。呵呵呵呵呵。。。因为下降火太快了,没办法,而降得慢又会。。。TLE,虽然精度提高了。敢问,还有什么好的方法?我是在做退火算法时遇到这个练手的。#include #include #includ... 阅读全文
posted @ 2014-08-12 16:14 chenjunjie1994 阅读(222) 评论(0) 推荐(0) 编辑
摘要:模拟退火算法。随机MAX个点,然后,退火移动,选取距离所有点中最短中最长者即可。理解和我上一篇一样。#include #include #include #include #include #include using namespace std;const int MAXN=1010;const ... 阅读全文
posted @ 2014-08-12 11:19 chenjunjie1994 阅读(250) 评论(0) 推荐(0) 编辑
摘要:模拟退火算法。昨天看了PPT,原来模拟退火算法涉及到马尔什么链,开始理解,它其实就是一个关于抽样的问题。随机抽样,选取足够多的样本,然后逐步逼近。而在平面上,由于T的下降,使得逐渐缩小至一点。然后,就可以了。算法:在平面上随机选取一些点,当然这些点应当有一点相关的性吧。我猜的。然后在这些点随机移动,... 阅读全文
posted @ 2014-08-12 09:27 chenjunjie1994 阅读(261) 评论(0) 推荐(0) 编辑
摘要:基本小圆覆盖模板题#include #include #include using namespace std;int X,Y; int n;const double eps=0.00000001;struct point{ double x,y;}p[550]; struct Circle{... 阅读全文
posted @ 2014-08-11 11:52 chenjunjie1994 阅读(305) 评论(0) 推荐(0) 编辑
摘要:模拟退火算法。暂时不是很理解,待我理解了再写一个总结。求的是球的最小包含#include #include #include #include #include using namespace std;const int MAXN=35;const double inf=1e10;const dou... 阅读全文
posted @ 2014-08-11 10:38 chenjunjie1994 阅读(183) 评论(0) 推荐(0) 编辑
摘要:求的是凸包有多少个面。注意,求的是面。这就需要把同一个面的三角形合并。只需判断两个三角形的法向量是否同向平行。/*增量法求凸包。选取一个四面体,同时把它各面的方向向量向外,增加一个点时,若该点与凸包上的某些面的方向向量在同一侧,则去掉那些面,并使某些边与新增点一起连成新的凸包上的面。 */ #inc... 阅读全文
posted @ 2014-08-10 15:16 chenjunjie1994 阅读(182) 评论(0) 推荐(0) 编辑
摘要:题意很明白要求多边形重心。方法已在上篇讲过了。 #include #include #include #include #include using namespace std; const int MAXN=1000005; struct point { double x,y; }; ... 阅读全文
posted @ 2014-08-10 14:11 chenjunjie1994 阅读(141) 评论(0) 推荐(0) 编辑
摘要:计算凸包重心到各面的最短距离。若知道重心,按四面体用体积法即可求出高。关键在于,多面体重心的求法。这必须把多面体分割成多个四面体来求。下面从多边形的重心说起。一般来用,对于一个多边形(p0,p1,p2....pn-1),其重心一般为pc.x=(p0.x+p1.x+....)/n对于y也一样。但这其实... 阅读全文
posted @ 2014-08-10 11:11 chenjunjie1994 阅读(291) 评论(0) 推荐(0) 编辑
摘要:直线关于球的多次反射,求最后一次反射点#include #include #include #include #include using namespace std;const double inf=1e10;const double eps=1e-8;struct point { doub... 阅读全文
posted @ 2014-08-10 09:26 chenjunjie1994 阅读(132) 评论(0) 推荐(0) 编辑
摘要:三维凸包/*增量法求凸包。选取一个四面体,同时把它各面的方向向量向外,增加一个点时,若该点与凸包上的某些面的方向向量在同一侧,则去掉那些面,并使某些边与新增点一起连成新的凸包上的面。 */ #include #include #include #include #include using name... 阅读全文
posted @ 2014-08-10 09:16 chenjunjie1994 阅读(196) 评论(0) 推荐(0) 编辑
摘要:主要利用PICK定理与边点数上的GCD的关系求解。三角形一条边上的所有整数点(包括顶点)可以首先将这条边移到(0, 0)->(x, y)。这时,(x/gcd(x, y), y/gcd(x, y))肯定在这条边上,并且是整数点,其余所有整数点的可以表示为k(x/gcd(x, y), y/gcd(x, ... 阅读全文
posted @ 2014-08-09 19:58 chenjunjie1994 阅读(197) 评论(0) 推荐(0) 编辑
摘要:坑,直接把公路看成X轴来做,然后,排序扫描一下,你懂的。#include #include #include #include using namespace std;const int MAXN=10100;struct Village{ double l,r;};Village p[MAXN];... 阅读全文
posted @ 2014-08-09 11:55 chenjunjie1994 阅读(211) 评论(0) 推荐(0) 编辑
摘要:求异面直线距离及公垂线公式转自:http://blog.csdn.net/zhengnanlee/article/details/11870595 (求公垂线)两条直线:构造方程:求出公垂线向量:记公垂线和l1形成的平面为alpha,下面求它:令:联立:#include #include #incl... 阅读全文
posted @ 2014-08-09 10:50 chenjunjie1994 阅读(395) 评论(0) 推荐(0) 编辑
摘要:题目多读几次就明白了。主要是求异面直线的距离,然后用距离和两圆半径之和作比较。空间直线的距离d=|AB*n| / |n| (AB表示异面直线任意2点的连线,n表示法向量,法向量为两条异面直线方向向量的叉积,|n|表示模。#include #include #include #include #inc... 阅读全文
posted @ 2014-08-08 21:54 chenjunjie1994 阅读(206) 评论(0) 推荐(0) 编辑
摘要:列出不等式后,把同时除Z把它去掉。注意了,这里应该 是把直线变两点表示的向量更为简单,我开始就直接用直线写,后来,唉,写不下去了。。#include #include #include #include using namespace std;const int MAX=110;const doub... 阅读全文
posted @ 2014-08-08 11:33 chenjunjie1994 阅读(246) 评论(0) 推荐(0) 编辑
摘要:如果你理解上一题的把多边形各边向内推进R的含义,那么,这题就是水题了^-^当各边都向内推进R时,所得交点即可作为半径为R的圆的圆心了,那么,枚举推进后多边形各点的距离,取最远两点,即为答案了。#include #include #include #include using namespace st... 阅读全文
posted @ 2014-08-07 14:40 chenjunjie1994 阅读(143) 评论(0) 推荐(0) 编辑
摘要:/*在一个多边形内切最大的圆,可以知道,当一个多形放大或缩小时,内切圆也随比例放大或缩小。于是,在多边形各边向内压缩R时,最大圆半径必定减少R。那么,直至为半平面交空集时,得到R即为最大半径。下面,想解释一下 坐标转换代码。坐标转换可以通过解方程求得。设转换后为x,y.按多边形顺时针顺序排,有:(x... 阅读全文
posted @ 2014-08-07 13:42 chenjunjie1994 阅读(158) 评论(0) 推荐(0) 编辑
摘要:这题,加了精度错了,不加精度反而对了。。。#include #include #include #include #include using namespace std;const int MAXN=110;const double eps=1e-8; struct point { doub... 阅读全文
posted @ 2014-08-07 11:06 chenjunjie1994 阅读(222) 评论(0) 推荐(0) 编辑
摘要:发现好多半平面交用N^2的增量法都能过诶。。。#include #include #include #include #include using namespace std;const int MAXN=1550;const double eps=1e-8;struct point { doubl... 阅读全文
posted @ 2014-08-06 15:36 chenjunjie1994 阅读(147) 评论(0) 推荐(0) 编辑
摘要:半平面交模板#include #include #include #include #include using namespace std;const int MAXN=110;const double eps=1e-8;struct point { double x,y;};point pts[... 阅读全文
posted @ 2014-08-06 15:03 chenjunjie1994 阅读(177) 评论(0) 推荐(0) 编辑
摘要:/*半平面交求核心的增量法:假设前N-1个半平面交,对于第N个半平面,只需用它来交前N-1个平面交出的多边形。算法开始时,调整点的方向为顺时针方向,对于是否为顺时针,只需求出其面积,若为正,必为逆时针的。对于每相邻两点求出一条直线,用该直线去交其半平面,并求出交点及判断原多边形点的方位。*/ #in... 阅读全文
posted @ 2014-08-06 13:53 chenjunjie1994 阅读(126) 评论(0) 推荐(0) 编辑
摘要:bitch bitch bitch...TLE,WA一大坨,我是在拿生命来JUDGE啊。。不得不说,UVA上的数据根本不是随机的,而是有预谋的。 for(int i=2;i1&&cross(p[i],p[st[stop-1]],p[st[stop-2]])>=0) stop--; //这个我本来是... 阅读全文
posted @ 2014-08-05 21:36 chenjunjie1994 阅读(444) 评论(0) 推荐(0) 编辑
摘要:/*这是用的有旋转卡壳的思想。首先确定i,j,对k进行循环,知道找到第一个k使得cross(i,j,k)>cross(i,j,k+1),如果k==i进入下一次循环。对j,k进行旋转,每次循环之前更新最大值,然后固定一个j,同样找到一个k使得cross(i,j,k)>cross(i,j,k+1)。对j... 阅读全文
posted @ 2014-08-05 00:13 chenjunjie1994 阅读(287) 评论(0) 推荐(0) 编辑
摘要:呃,不知道我用的算不算卡壳,总有点枚举的意思。先求凸包,然后,枚举其中一点,再枚举另一点作为结尾,这个向量旋转一周后,求出最大值面积。这里面用的是旋转卡壳判断的那个式子。PS:下一篇和这题是一样题意,但用这题的写法去过下一题,是过不了的。但这个写法在POJ 上是400MS,而下一题的写法在POJ上是... 阅读全文
posted @ 2014-08-04 21:02 chenjunjie1994 阅读(237) 评论(0) 推荐(0) 编辑
摘要:1.计算P上y坐标值最小的顶点(称为 yminP )和Q上y坐标值最大的顶点(称为 ymaxQ)。2.为多边形在 yminP 和 ymaxQ 处构造两条切线 LP 和 LQ 使得他们对应的多边形位于他们的右侧。此时 LP 和 LQ 拥有不同的方向, 并且 yminP 和 ymaxQ 成为了多边形间的... 阅读全文
posted @ 2014-08-04 20:06 chenjunjie1994 阅读(252) 评论(0) 推荐(0) 编辑
摘要:旋 转卡壳水题。直接使用旋转卡壳求距离。#include #include #include #include #include using namespace std;const int MAXN=50100;struct point { int x,y;}p[MAXN];int n;int st... 阅读全文
posted @ 2014-08-03 15:36 chenjunjie1994 阅读(128) 评论(0) 推荐(0) 编辑
摘要:最小圆覆盖#include #include #include #include using namespace std;const double eps=0.00000001;struct point { double x,y;}p[110];struct circle{ point cent; ... 阅读全文
posted @ 2014-08-01 22:27 chenjunjie1994 阅读(179) 评论(0) 推荐(0) 编辑
摘要:最小圆覆盖问题。根据黑书上的算法写的。定理:PI不在当前的圆内,则必在扩张后的圆上,即扩张后的圆必定经过PI。因为求最小圆使用的是点增量法,把问题规模由1增加到N。所以,每次增加规模时,必须先确定该点是否在圆内,若不在,则扩展。并以当前点为其中之一点,然后在P1,P2,....P(I-1)枚举另外两... 阅读全文
posted @ 2014-08-01 19:23 chenjunjie1994 阅读(149) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示