12 2016 档案
摘要:C. New Year and Rating time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output C. New Year and R
阅读全文
摘要:The Euler function Problem Description The Euler function phi is an important kind of function in number theory, (n) represents the amount of the numb
阅读全文
摘要:GCD Again Problem Description Do you have spent some time to think and try to solve those unsolved problem after one ACM contest? No? Oh, you must do
阅读全文
摘要:欧拉函数证明 欧拉函数定义:定义一个数n,φ(n)为不大于n的,与n互质的数的个数。 证明方法用到容斥定理:容斥定理的原理如图: A∪B∪C=A+B+C - A∩B - B∩C - A∩C + A∩B∩C; 欧拉函数证明: 小于等于n的基数有n个,讨论所有n的素因子,只要是素因子的倍数的是都不是n的
阅读全文
摘要:Assignments Problem Description In a factory, there are N workers to finish two types of tasks (A and B). Each type has N tasks. Each task of type A n
阅读全文
摘要:Wall Problem Description Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King w
阅读全文
摘要:Maple trees Problem Description There are a lot of trees in HDU. Kiki want to surround all the trees with the minimal required length of the rope . As
阅读全文
摘要:WisKey的眼神 Problem Description WisKey的眼镜有500多度,所以眼神不大好,而且他有个习惯,就是走路喜欢看着地(不是为了拣钱哦^_^),所以大家下次碰见他的时候最好主动打下招呼,呵呵.但是Rabbit总是喜欢扮神秘,一天WisKey去食堂排队等着买饭,突然收到一道短消
阅读全文
摘要:Surround the Trees Problem Description There are a lot of trees in an area. A peasant wants to buy a rope to surround all these trees. So at first he
阅读全文
摘要:了解凸包及Graham扫描法 问题描述:二位平面内,给定n个散乱的点,求一个最小凸多边形(凸包),使得n个点都不在凸多边形外。 问题的解决用到Graham算法: 算法步骤: 1.取y坐标最小的一点,作为p0,显然p0一定在凸包上。 2.将p0作为坐标系原点,其他点按极角从小到大排序,从p1开始编号。
阅读全文
摘要:多边形求重心总结 多边形求重心: 逆时针给出你n边形的n个顶点,求重心利用的原理就是,加权平均,如下图: 将a点作为所有小三角形的公共顶点,那么多边形abcdef的中心=); 三角形的面积:用向量的×乘就可以 s1=向量ac×向量ba;(尽量不要用海伦公式,因为海林公式除法太多,容易卡精度) 三角形
阅读全文
摘要:Lifting the Stone Problem Description There are many secret openings in the floor which are covered by a big heavy stone. When the stone is lifted up,
阅读全文
摘要:You can Solve a Geometry Problem too Problem Description Many geometry(几何)problems were designed in the ACM/ICPC. And now, I also prepare a geometry p
阅读全文
摘要:计算几何-判断线段相交 判断两线段是否相交: 快速排斥 跨立实验(这两个词也是我看博客的时候看到的,觉得挺高大上的就拿过来用了,哈哈哈) 1. 快速排斥:就是初步的判断一下,两条线段是不是相交,以两条线段为对角线的矩形,如果不重合的话,那么两条线段一定不可能相交。看下图: 1.线段ab的低点低于cd
阅读全文
摘要:Shape of HDU Problem Description 话说上回讲到海东集团推选老总的事情,最终的结果是XHD以微弱优势当选,从此以后,“徐队”的称呼逐渐被“徐总”所取代,海东集团(HDU)也算是名副其实了。创业是需要地盘的,HDU向钱江肉丝高新技术开发区申请一块用地,很快得到了批复,据说
阅读全文
摘要:凸多边形 凸多边形的判断方法: 1)角度法: 判断每个顶点所对应的内角是否小于180度,如果小于180度,则是凸的,如果大于180度,则是凹多边形。 2)凸包法: 这种方法首先计算这个多边形的凸包,关于凸包的定义在此不再赘述,首先可以肯定的是凸包肯定是一个凸多边形。如果计算出来的凸多边形和原始多边形
阅读全文
摘要:Cat vs. Dog Problem Description The latest reality show has hit the TV: ``Cat vs. Dog''. In this show, a bunch of cats and dogs compete for the very p
阅读全文
摘要:Uncle Tom's Inherited Land* Problem Description Your old uncle Tom inherited a piece of land from his great-great-uncle. Originally, the property had
阅读全文
摘要:50 years, 50 colors Problem Description On Octorber 21st, HDU 50-year-celebration, 50-color balloons floating around the campus, it's so nice, isn't i
阅读全文
摘要:Air Raid Problem Description Consider a town where all the streets are one-way and each street leads from one intersection to another. It is also know
阅读全文
摘要:Machine Schedule Problem Description As we all know, machine scheduling is a very classical problem in computer science and has been studied for a ver
阅读全文
摘要:Girls and Boys Problem Description the second year of the university somebody started a study on the romantic relations between the students. The rela
阅读全文
摘要:二分匹配总结 首先讲一下什么是二分图,在一个图中,以边为条件,能将两个端点划分为两个集合的图叫做二分图,如下图: 左图为二分图,右图为简化后的二分图。 接着就是二分图的匹配问题,二分图的匹配就是找一个边的集合,每条边的的顶点的度数为1。 如上图所示,匹配到四条边。 二分图的完美匹配,就是所有的顶点都
阅读全文
摘要:C. Tram time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The tram in Berland goes along a
阅读全文
摘要:Strategic Game Problem Description Bob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enoug
阅读全文
摘要:Code Lock Problem Description A lock you use has a code system to be opened instead of a key. The lock contains a sequence of wheels. Each wheel has t
阅读全文
摘要:Einbahnstrasse Problem Description Einbahnstra e (German for a one-way street) is a street on which vehicles should only move in one direction. One re
阅读全文
摘要:A Walk Through the Forest Problem Description Jimmy experiences a lot of stress at work these days, especially since his accident made working difficu
阅读全文
摘要:D. Chloe and pleasant prizes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output D. Chloe an
阅读全文
摘要:find the safest road Problem Description XX星球有很多城市,每个城市之间有一条或多条飞行通道,但是并不是所有的路都是很安全的,每一条路有一个安全系数s,s是在 0 和 1 间的实数(包括0,1),一条从u 到 v 的通道P 的安全度为Safe(P) = s(
阅读全文
摘要:Here We Go(relians) Again Problem Description The Gorelians are a warlike race that travel the universe conquering new worlds as a form of recreation.
阅读全文
摘要:In Action Problem Description Since 1945, when the first nuclear bomb was exploded by the Manhattan Project team in the US, the number of nuclear weap
阅读全文
摘要:/* 数学是硬伤。。。。。。推了半小时推出来一个错误的公式 */ #include #include #include #include #define mod 1000000007 using namespace std; int n,t; /* 推出来的错误公式。。。。。。。 f[n]=f[n-1]+(n-1)*(f[n-1]-1); */ long long a[2000500];...
阅读全文
摘要:/* 成功水过,哈哈哈,可能数据水吧 */ #include #include #include #include #include #define t_mid (l+r >> 1) #define ls (o= ql && c[ls] <= x) { ans = query(ql,qr,lson,x); if(ans == -1) ...
阅读全文
摘要:/* 以前做过一个插队的题,这个类似从后往前操作 */ #include #include #include #include #include #define N 600000 using namespace std; struct node { int x,y,z; //每一个操作,z表示这个操作是不是有效的 node(){} node(int a,...
阅读全文
摘要:HDU Today Problem Description 经过锦囊相助,海东集团终于度过了危机,从此,HDU的发展就一直顺风顺水,到了2050年,集团已经相当规模了,据说进入了钱江肉丝经济开发区500强。这时候,XHD夫妇也退居了二线,并在风景秀美的诸暨市浬浦镇陶姚村买了个房子,开始安度晚年了。这
阅读全文
摘要:最短路 Problem Description 在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗? Input 输入包括多组数据。每组数据第一
阅读全文
摘要:Pseudoforest Problem Description In graph theory, a pseudoforest is an undirected graph in which every connected component has at most one cycle. The
阅读全文
摘要:Connect the Cities Problem Description In 2100, since the sea level rise, most of the cities disappear. Though some survived cities are still connecte
阅读全文
摘要:Jungle Roads Problem Description The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roa
阅读全文
摘要:继续畅通工程 Problem Description 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。现得到城镇道路统计表,表中列出了任意两城镇间修建道路的费用,以及该道路是否已经修通的状态。现请你编写程序,计算出全省畅通需要
阅读全文
摘要:还是畅通工程 Problem Description 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。 Inp
阅读全文
摘要:畅通工程 Problem Description 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input 测试输入
阅读全文
摘要:Eddy's picture Problem Description Eddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pict
阅读全文
摘要:Constructing Roads Problem Description There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villa
阅读全文
摘要:Buy the Ticket Problem Description The \\\\\\\"Harry Potter and the Goblet of Fire\\\\\\\" will be on show in the next few days. As a crazy fan of Har
阅读全文
摘要:C. Arpa's loud Owf and Mehrdad's evil plan time limit per test 1 second memory limit per test 256 megabytes input standard input output standard outpu
阅读全文
摘要:B. Arpa’s obvious problem and Mehrdad’s terrible solution time limit per test 1 second memory limit per test 256 megabytes input standard input output
阅读全文
摘要:Last non-zero Digit in N! Problem Description The expression N!, read as "N factorial," denotes the product of the first N positive integers, where N
阅读全文
摘要:Disharmony Trees Problem Description One day Sophia finds a very big square. There are n trees in the square. They are all so tall. Sophia is very int
阅读全文