• 「CF399A」Pages

    「CF399A」Pages

    Useraintaismakingawebsite.Thistimeheisgoingtomakeanavigationofthepages.Inhissite,thereare n pagesnumberedbyintegersfrom 1 to n.Assumethatsomebodyisonthe p-thpagenow.Thenavigationwilllooklikethis:  << p - k p - k + 1 ... p - 1 (p) p + 1 ... p + k - 1 p + k >>Whensomeoneclicksthebutton"<<"heisredirectedtopage 1,andwhensomeoneclicksth...

    02014年3月2日2,464模拟
  • 「CF397A」On Segment’s Own POInts

    「CF397A」On Segment's Own POInts

    OuroldfriendAlexeyhasfinallyenteredtheUniversityofCityN—theBerlandcapital.AlexeyexpectedhisfathertogethimaplacetoliveinbuthisfathersaiditwashightimeforAlexeytopracticesomefinancialindependence.So,Alexeyislivinginadorm.Thedormhasexactlyonestraightdryer—a 100 centimeterlongropetohangclotheson.Thedryerhasgotacoordinatesysteminstalled:theleftmostendofthedryerhascoordinate 0,andtheoppo...

    02014年3月1日2,701模拟
  • 「POJ2828」Buy Tickets

    「POJ2828」Buy Tickets

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

    02014年3月1日4,381线段树,离线处理
  • 「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,521spfa,二分法
  • 「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日3,905筛法
  • 「CODEVS1034」家园

    「CODEVS1034」家园

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

    02014年2月28日3,489最大流
  • 「网络流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,541最小割
  • 「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,366博弈论
  • 「POJ2234」Matches Game

    「POJ2234」Matches Game

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

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

    「BZOJ1054」[HAOI2008] 移动玩具

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

    02014年2月27日5,329哈希表,广度搜索
  • 「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,302广度搜索
  • 「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,876spfa
117 / 145 « 上一页 1 ...115 116 117 118 119 ...145 下一页 »