摘要: CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#include<iostream>#include<algorithm>usingnamespacestd;constintMAXN=55;typedefstruct{doublex,y;}Point;Pointp[MAXN];Pointp0={0,0};boolcmp1(constPoint&a,constPoint&b)//y升序,y相同x升 阅读全文
posted @ 2009-10-10 19:02 shenyaoxing 阅读(223) 评论(0) 推荐(0) 编辑
摘要: CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->//公式a^2-b^2-c^2+2bccosA=0=>cosA=(b^2+c^2-a^2)/2bc,sinA/a=sinB/b=sinC/c=1/2R#include<iostream>#include<math.h>usingnamespacestd;constdoublepi=acos(-1.0);typedefstruct{doublex,y;}Poi 阅读全文
posted @ 2009-10-10 09:36 shenyaoxing 阅读(205) 评论(0) 推荐(0) 编辑
摘要: CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->//题意:给定一张有向图,边有权值,要你计算从min[1N](某点开始到达其他所有点的最短时间的和)//思路:用Floyd做,求两点间的最短距离,时间复杂度为O(N^3)#include<iostream>usingnamespacestd;constintMAXN=102;constintINF=-1u>>1;intmap[MAXN][MAXN];intMax[ 阅读全文
posted @ 2009-10-10 08:26 shenyaoxing 阅读(181) 评论(0) 推荐(0) 编辑
摘要: CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->//题意:让你给图增加最少的边数,使得一旦图的某条边断掉后其它节点间仍然可达//思路:利用缩图成树的方法,最终算出数的叶子数,(leafnum+1)/2就是答案了#include<iostream>usingnamespacestd;constintMAXN=2010;typedefstruct{//其实起点保存在边的下标中intnext;//该边指向的下一条边编号inte; 阅读全文
posted @ 2009-10-09 19:54 shenyaoxing 阅读(183) 评论(0) 推荐(0) 编辑