• 「POJ2828」Buy Tickets

    「POJ2828」Buy Tickets

    DescriptionRailwayticketsweredifficulttobuyaroundtheLunarNewYearinChina,sowemustgetupearlyandjoinalongqueue…TheLunarNewYearwasapproaching,butunluckilytheLittleCatstillhadschedulesgoinghereandthere.Now,hehadtotravelbytraintoMianyang,SichuanProvinceforthewintercampselectionofthenationalteamofOlympiadinInformatics.Itwasoneo’clocka.m.anddarkoutside.Chillwindfromthenorthwestdidnot...

    02014年3月1日4,565线段树,离线处理
  • 「BZOJ1614」[Usaco2007 Jan] Telephone Lines架设电话线

    「BZOJ1614」[Usaco2007 Jan] Telephone Lines架设电话线

    题目描述FarmerJohn打算将电话线引到自己的农场,但电信公司并不打算为他提供免费服务。于是,FJ必须为此向电信公司支付一定的费用。   FJ的农场周围分布着N(1<=N<=1,000)根按1..N顺次编号的废弃的电话线杆,任意两根电话线杆间都没有电话线相连。一共P(1<=P<=10,000)对电话线杆间可以拉电话线,其余的那些由于隔得太远而无法被连接。    第i对电话线杆的两个端点分别为A_i、B_i,它们间的距离为L...

    32014年3月1日6,669spfa,二分法
  • 「POJ2262」Goldbach’s Conjecture

    「POJ2262」Goldbach's Conjecture

    DescriptionIn1742,ChristianGoldbach,aGermanamateurmathematician,sentalettertoLeonhardEulerinwhichhemadethefollowingconjecture:Everyevennumbergreaterthan4canbewrittenasthesumoftwooddprimenumbers.Forexample:8=3+5.Both3and5areoddprimenumbers.20=3+17=7+13.42=5+37=11+31=13+29=19+23.Todayitisstillunprovenwhethertheconjectureisright.(Ohwait,Ihavetheproofofcourse,butitistoolongtowriteitonthem...

    22014年2月28日4,010筛法
  • 「CODEVS1034」家园

    「CODEVS1034」家园

    题目描述 Description由于人类对自然的疯狂破坏,人们意识到在大约2300年之后,地球不能再居住了,于是在月球上建立了新的绿地,以便在需要时移民。令人意想不到的是,2177年冬由于未知的原因,地球环境发生了连锁崩溃,人类必须在最短的时间内迁往月球。现有n个太空站处于地球与月球之间(编号1..n),m艘公共交通太空船在其中来回穿梭,每个太空站Si可容纳无限的人,每艘太空船pi只可容纳Hpi人。对于每一艘太空船pi,将周期性...

    02014年2月28日3,629最大流
  • 「网络流24题」最小路径覆盖问题

    「网络流24题」最小路径覆盖问题

    Description问题描述:给定有向图G=(V,E)。设P是G的一个简单路(顶点不相交)的集合。如果V中每个顶点恰好在P的一条路上,则称P是G的一个路径覆盖。P中路径可以从V的任何一个顶点开始,长度也是任意的,特别地,可以为0。G的最小路径覆盖是G的所含路径条数最少的路径覆盖。设计一个有效算法求一个有向无环图G的最小路径覆盖。编程任务:对于给定的给定有向无环图G,编程找出G的一个最小路径覆盖。InputFormat文...

    02014年2月28日9,786最小割
  • 「POJ1740」A New Stone Game

    「POJ1740」A New Stone Game

    DescriptionAliceandBobdecidetoplayanewstonegame.Atthebeginningofthegametheypickn(1<=n<=10)pilesofstonesinaline.AliceandBobmovethestonesinturn.Ateachstepofthegame,theplayerchooseapile,removeatleastonestones,thenfreelymovestonesfromthispiletoanyotherpilethatstillhasstones.Forexample:n=4andthepileshave(3,1,4,2)stones.Iftheplayerchosethefirstpileandremoveone.Thenitcanreachthefollowstat...

    02014年2月27日3,468博弈论
  • 「POJ2234」Matches Game

    「POJ2234」Matches Game

    DescriptionHereisasimplegame.Inthisgame,thereareseveralpilesofmatchesandtwoplayers.Thetwoplayerplayinturn.Ineachturn,onecanchooseapileandtakeawayarbitrarynumberofmatchesfromthepile(Ofcoursethenumberofmatches,whichistakenaway,cannotbezeroandcannotbelargerthanthenumberofmatchesinthechosenpile).Ifafteraplayer’sturn,thereisnomatchleft,theplayeristhewinner.Supposethatthetwoplayersareallverycle...

    02014年2月27日4,011博弈论
  • 「BZOJ1054」[HAOI2008] 移动玩具

    「BZOJ1054」[HAOI2008] 移动玩具

    Description在一个4*4的方框内摆放了若干个相同的玩具,某人想将这些玩具重新摆放成为他心中理想的状态,规定移动时只能将玩具向上下左右四个方向移动,并且移动的位置不能有玩具,请你用最少的移动次数将初始的玩具状态移动到某人心中的目标状态。Input前4行表示玩具的初始状态,每行4个数字1或0,1表示方格中放置了玩具,0表示没有放置玩具。接着是一个空行。接下来4行表示玩具的目标状态,每行4个数字1或0,意义同上。Output...

    02014年2月27日5,481哈希表,广度搜索
  • 「POJ3275」Ranking the Cows

    「POJ3275」Ranking the Cows

    DescriptionEachofFarmerJohn's N cows(1≤ N ≤1,000)producesmilkatadifferentpositiverate,andFJwouldliketoorderhiscowsaccordingtotheseratesfromthefastestmilkproducertotheslowest.FJhasalreadycomparedthemilkoutputratefor M (1≤ M ≤10,000)pairsofcows.Hewantstomakealistof C additionalpairsofcowssuchthat,ifhenowcomparesthose C pairs,hewilldefinitelybeabletodeducethecorrectorde...

    02014年2月27日3,394广度搜索
  • 「POJ3255」Roadblocks

    「POJ3255」Roadblocks

    DescriptionBessiehasmovedtoasmallfarmandsometimesenjoysreturningtovisitoneofherbestfriends.Shedoesnotwanttogettoheroldhometooquickly,becauseshelikesthesceneryalongtheway.Shehasdecidedtotakethesecond-shortestratherthantheshortestpath.Sheknowstheremustbesomesecond-shortestpath.Thecountrysideconsistsof R (1≤ R ≤100,000)bidirectionalroads,eachlinkingtwooftheN(1≤ N ≤5000)intersectio...

    02014年2月27日2,931spfa
  • 最少转弯

    最少转弯

    http://218.5.5.242:9018/JudgeOnline/problem.php?id=1434题目描述给出一张地图,这张地图被分为n×m(n,m<=100)个方块,任何一个方块不是平地就是高山。平地可以通过,高山则不能。现在你处在地图的(x1,y1)这块平地,问:你至少需要拐几个弯才能到达目的地(x2,y2)?你只能沿着水平和垂直方向的平地上行进,拐弯次数就等于行进方向的改变(从水平到垂直或从垂直到水平)的次数。例如:如图1,最少的拐弯次数为5。  输...

    02014年2月26日2,607广度搜索
  • 「BZOJ1040」[ZJOI2008] 骑士

    「BZOJ1040」[ZJOI2008] 骑士

    DescriptionZ国的骑士团是一个很有势力的组织,帮会中汇聚了来自各地的精英。他们劫富济贫,惩恶扬善,受到社会各界的赞扬。最近发生了一件可怕的事情,邪恶的Y国发动了一场针对Z国的侵略战争。战火绵延五百里,在和平环境中安逸了数百年的Z国又怎能抵挡的住Y国的军队。于是人们把所有的希望都寄托在了骑士团的身上,就像期待有一个真龙天子的降生,带领正义打败邪恶。骑士团是肯定具有打败邪恶势力的能力的,但是骑士们互相...

116 / 144 « 上一页 1 ...114 115 116 117 118 ...144 下一页 »