摘要: 转自http://www.cnblogs.com/perseawe/archive/2012/05/03/01fsgh.html//原版为pascal代码,C++代码是我自己写的,写得不好敬请见谅【关键字】0/1分数规划、最优比率生成树、最优比率环【背景】根据楼教主的回忆录,他曾经在某一场比赛中秒掉了一道最优比率生成树问题,导致很多人跟风失败,最终悲剧。自己总结了一些这种问题的解法,因为水平有限,如果有错误或是麻烦的地方,尽管喷,邮箱或是下方留言。联系我的话perseawe@163.com,欢迎讨论,请在标题前注明[acm]或是[oi],以免被垃圾邮件。【知识储备】只会用到简单的公式的整理与变 阅读全文
posted @ 2013-06-04 16:51 Oyking 阅读(479) 评论(0) 推荐(0) 编辑
摘要: 转自http://www.cnblogs.com/perseawe/archive/2012/05/03/01fsgh.html【关键字】0/1分数规划、最优比率生成树、最优比率环【背景】根据楼教主的回忆录,他曾经在某一场比赛中秒掉了一道最优比率生成树问题,导致很多人跟风失败,最终悲剧。自己总结了一些这种问题的解法,因为水平有限,如果有错误或是麻烦的地方,尽管喷,邮箱或是下方留言。联系我的话perseawe@163.com,欢迎讨论,请在标题前注明[acm]或是[oi],以免被垃圾邮件。【知识储备】只会用到简单的公式的整理与变形,还有求和sigma。【定义】01分数规划问题:所谓的01分数规划 阅读全文
posted @ 2013-06-04 10:54 Oyking 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 using namespace std; 4 5 bool isPrime[1000000]; 6 int prime[1000000]; 7 int MAX, total, cnt; 8 ... 阅读全文
posted @ 2013-06-04 10:47 Oyking 阅读(414) 评论(0) 推荐(0) 编辑
摘要: ProblemDescriptionBandBandRockisquitesensitivewithnumbers(anumberisdefinedasasequenceformedby‘0’-‘9’).Hethinksthislistofluckynumberscanbringhimluck(forexamplehisluckylistcouldbe9,13)andhelovesthesenumbersverymuch!Oneday,BandBandRockischoosingapasswordforhisbankaccount(apasswordisasequenceformedby‘0’ 阅读全文
posted @ 2013-06-04 10:45 Oyking 阅读(1142) 评论(0) 推荐(0) 编辑
摘要: DescriptionAliceandBobmeetagain.ThistimetheyplayagamenamedMATRIXTRANSFORMER.Theygotann*nboard.Everygridhastwopositions,UPandDOWN.Inthisgameyoucanpushsomeamazingbuttonstoexchangeanytworowsoranytwocolumns.AlicewillwinifshegotthegridsinthemaindiagonallineallUP.ButAlicefindsthatforsomeboard,nomatterhowm 阅读全文
posted @ 2013-06-04 10:44 Oyking 阅读(163) 评论(0) 推荐(0) 编辑
摘要: ProblemDescription传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到一间房子另一方面,村长和另外的村领导希望得到最大的效益,这样村里的机构才会有钱.由于老百姓都比较富裕,他们都能对每一间房子在他们的经济范围内出一定的价格,比如有3间房子,一家老百姓可以对第一间出10万,对第2间出2万,对第3间出20万.(当然是在他们的经济范围内).现在这个问题就是村领导怎样分配房子才能 阅读全文
posted @ 2013-06-04 10:43 Oyking 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3618ProblemDescriptionFJhastwosamehousesforrant.Nowhehasn(1≤n≤1000)pieceoforder,theordersaregiveninthef... 阅读全文
posted @ 2013-06-04 10:41 Oyking 阅读(334) 评论(0) 推荐(0) 编辑
摘要: ProblemDescriptionAgroupofthievesisapproachingamuseuminthecountryofzjsxzy,nowtheyareincityA,andthemuseumisincityB,wherekeepsmanybrokenlegsofzjsxzy.Luckily,GWlearnedtheconspiracywhenheiswatchingstarsandtoldittozjsxzy.Zjsxzydecidedtocaughtthesethieves,andheletthepolicetodothis,thepolicetrytocatchthemo 阅读全文
posted @ 2013-06-04 10:38 Oyking 阅读(342) 评论(0) 推荐(0) 编辑
摘要: 在二分图中,最大匹配数 = 最大流 = 最小割 = 最小点集覆盖 = 总点数 - 最大独立集 Knig定理的证明:(还是matrix67讲得清楚:http://www.matrix67.com/blog/archives/116) 假如我们已经通过匈牙利算法求出了最大匹配(假设它等于M),下面给出的 阅读全文
posted @ 2013-06-04 10:26 Oyking 阅读(672) 评论(0) 推荐(1) 编辑
摘要: Arobothasbeensenttoexplorearemoteplanet.Tospecifythepaththerobotshouldtake,aprogramissenteachday.Theprogramconsistsofasequenceofthefollowingcommands:F... 阅读全文
posted @ 2013-06-04 10:24 Oyking 阅读(234) 评论(0) 推荐(0) 编辑
摘要: DescriptionInacity,busisthemostpopularvehicleforcitizenstogofromoneplacetoanother.Unfortunately,sometimesonepersoncannottravelfromonebusstationtoanotherdirectly,becausethereisnobuslinethroughthesetwostations.Sohehadtogotoamedialstationfromthestartingstation,thenchangestoabuswhichgofromthisintermedia 阅读全文
posted @ 2013-06-04 10:22 Oyking 阅读(274) 评论(0) 推荐(0) 编辑
摘要: DescriptionArectangleisspecifiedbyapairofcoordinates(x1,y1)and(x2,y2)indicatingitslower-leftandupper-rightcorners(x1 #include #include #include ... 阅读全文
posted @ 2013-06-04 10:18 Oyking 阅读(218) 评论(0) 推荐(0) 编辑
摘要: D.ColorfulGraphtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYou'vegotanundirectedgraph,consistingofnverticesandmedges.Wewillconsiderthegraph'sverticesnumberedwithintegersfrom1ton.Eachvertexofthegraphhasacolor.Thecolorofthei-thvertexisanintegerci 阅读全文
posted @ 2013-06-04 10:16 Oyking 阅读(242) 评论(0) 推荐(0) 编辑
摘要: DescriptionAlicehasapianowhichcanplaysnicemusic,butit'sdifferentfromotherpianos.Ithastworowsofkeys,andthemethodofplayingitisalsoquitespecial.WhenAlice... 阅读全文
posted @ 2013-06-04 10:12 Oyking 阅读(240) 评论(0) 推荐(0) 编辑