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...
OuroldfriendAlexeyhasfinallyenteredtheUniversityofCityN—theBerlandcapital.AlexeyexpectedhisfathertogethimaplacetoliveinbuthisfathersaiditwashightimeforAlexeytopracticesomefinancialindependence.So,Alexeyislivinginadorm.Thedormhasexactlyonestraightdryer—a 100 centimeterlongropetohangclotheson.Thedryerhasgotacoordinatesysteminstalled:theleftmostendofthedryerhascoordinate 0,andtheoppo...
DescriptionRailwayticketsweredifficulttobuyaroundtheLunarNewYearinChina,sowemustgetupearlyandjoinalongqueue…TheLunarNewYearwasapproaching,butunluckilytheLittleCatstillhadschedulesgoinghereandthere.Now,hehadtotravelbytraintoMianyang,SichuanProvinceforthewintercampselectionofthenationalteamofOlympiadinInformatics.Itwasoneo’clocka.m.anddarkoutside.Chillwindfromthenorthwestdidnot...
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...
DescriptionAliceandBobdecidetoplayanewstonegame.Atthebeginningofthegametheypickn(1<=n<=10)pilesofstonesinaline.AliceandBobmovethestonesinturn.Ateachstepofthegame,theplayerchooseapile,removeatleastonestones,thenfreelymovestonesfromthispiletoanyotherpilethatstillhasstones.Forexample:n=4andthepileshave(3,1,4,2)stones.Iftheplayerchosethefirstpileandremoveone.Thenitcanreachthefollowstat...
DescriptionHereisasimplegame.Inthisgame,thereareseveralpilesofmatchesandtwoplayers.Thetwoplayerplayinturn.Ineachturn,onecanchooseapileandtakeawayarbitrarynumberofmatchesfromthepile(Ofcoursethenumberofmatches,whichistakenaway,cannotbezeroandcannotbelargerthanthenumberofmatchesinthechosenpile).Ifafteraplayer’sturn,thereisnomatchleft,theplayeristhewinner.Supposethatthetwoplayersareallverycle...
DescriptionEachofFarmerJohn's N cows(1≤ N ≤1,000)producesmilkatadifferentpositiverate,andFJwouldliketoorderhiscowsaccordingtotheseratesfromthefastestmilkproducertotheslowest.FJhasalreadycomparedthemilkoutputratefor M (1≤ M ≤10,000)pairsofcows.Hewantstomakealistof C additionalpairsofcowssuchthat,ifhenowcomparesthose C pairs,hewilldefinitelybeabletodeducethecorrectorde...
DescriptionBessiehasmovedtoasmallfarmandsometimesenjoysreturningtovisitoneofherbestfriends.Shedoesnotwanttogettoheroldhometooquickly,becauseshelikesthesceneryalongtheway.Shehasdecidedtotakethesecond-shortestratherthantheshortestpath.Sheknowstheremustbesomesecond-shortestpath.Thecountrysideconsistsof R (1≤ R ≤100,000)bidirectionalroads,eachlinkingtwooftheN(1≤ N ≤5000)intersectio...
近期评论