摘要:Who Gets the Most Candies?Time Limit: 5000MSMemory Limit: 131072KTotal Submissions: 8527Accepted: 2581Case Time Limit: 2000MSDescriptionN children are sitting in a circle to play a game.The children are numbered from 1 to N in clockwise order. Each of them has a card with a non-zero integer on it in
阅读全文
摘要:1.1序偶及有序n元组 有两个元素x和y按一定得次序排列组成的有序序列称为序偶或有序对,记作(与集合{x,y}不同);1.2笛卡尔积 设A和B为集合,称集合{|a属于AΛb属于B}为A和B的笛卡尔积,记作AxB。当A=B时,记为A2。 Ax(BυC)=(AxB)υ(AxC) Ax(B∩C)=(AxB)∩(AxC)2.1关系 任一序偶的集合确定了一个二元关系R,R中的任一序偶可记作属于R或aRb。不在R中的任一序偶可记作不属于R或aR非b。若aRb,我们说a和 b具有关系R 令R为二元关系,DR={x|至少存在一个y使得(xRy)}为定义域,RR={y|至少存在一个x使得(xRy)...
阅读全文
摘要:Buy TicketsTime Limit: 4000MSMemory Limit: 65536KTotal Submissions: 11157Accepted: 5450DescriptionRailway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Year was approaching, but unluckily the Little Cat still had schedul
阅读全文
摘要:BillboardTime Limit: 20000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8266 Accepted Submission(s): 3676 Problem DescriptionAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is
阅读全文
摘要:明知道是线段树,却写不出来,搞了半天,戳,没办法,最后还是得去看题解(有待于提高啊啊),想做道题还是难啊。还是先贴题吧HDU-1394 Minimum Inversion NumberTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8324Accepted Submission(s): 5115Problem DescriptionThe inversion number of a given number sequence a1, a2, .
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4407Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s)...
阅读全文
摘要:看了网上大牛们求重心的方法,自己也写写。假设x结点是树的重心,那么现在删除一个树的结点,就可以得到一些子树,那么得到的子树中结点个数最大的数要最小就是树的重心。(有点啰嗦)root = min(max(son(x)))枚举树的每个结点,计算以每个结点为根的对应的各个子树的结点的最大值,然后再取一个最...
阅读全文
摘要:匈牙利算法本文参考了大牛博客:https://www.byvoid.com/blog/hungary/设G=(V,E)是一个无向图。如顶点集V可分割为两个互不相交的子集V1,V2之选择这样的子集中边数最大的子集称为图的最大匹配问题(maximal matching problem)如果一个匹配中,|...
阅读全文
摘要:组合数c(n, m) = n! / (m!.(n - m)!),n! = elnn! = e(ln1 + ln2 + ... + lnn)则c(n, m) = e(ln1 + ln2 + ... + lnn) / (e(ln1 + ln2 + ... + lnm).e(ln1 + ln2 + ......
阅读全文