
ApplemanandToastmanplayagame.InitiallyApplemangivesonegroupof n numberstotheToastman,thentheystarttocompletethefollowingtasks:EachtimeToastmangetsagroupofnumbers,hesumsupallthenumbersandaddsthissumtothescore.ThenhegivesthegrouptotheAppleman.EachtimeApplemangetsagroupconsistingofasinglenumber,hethrowsthisgroupout.EachtimeApplemangetsagroupconsistingofmorethanonenumber,hesplitsthegrou...
![「BZOJ2212」[POI2011] Tree Rotations](http://www.lydsy.com:808/JudgeOnline/images/2212.jpg)
DescriptionByteasarthegardenerisgrowingararetreecalledRotatusInformatikus.Ithassomeinterestingfeatures:Thetreeconsistsofstraightbranches,bifurcationsandleaves.Thetrunkstemmingfromthegroundisalsoabranch.Eachbranchendswitheitherabifurcationoraleafonitstopend.Exactlytwobranchesforkoutfromabifurcationattheendofabranch-theleftbranchandtherightbranch.Eachleafofthetreeislabelledwithanintegerfro...

LittleDimamisbehavedduringamathlessonalotandthenastyteacherMr.Picklesgavehimthefollowingproblemasapunishment.Findallintegersolutions x (0 < x < 109) oftheequation:x = b·s(x)a + c, where a, b, c aresomepredeterminedconstantvaluesandfunction s(x) determinesthesumofalldigitsinthedecimalrepresentationofnumber x.TheteachergivesthisproblemtoDimaforeachlesson.Hechangeson...

Vasyahas n pairsofsocks.InthemorningofeachdayVasyahastoputonapairofsocksbeforehegoestoschool.Whenhecomeshomeintheevening,Vasyatakesofftheusedsocksandthrowsthemaway.Every m-thday(atdayswithnumbers m, 2m, 3m, ...)mombuysapairofsockstoVasya.Shedoesitlateintheevening,sothatVasyacannotputonanewpairofsocksbeforethenextday.HowmanyconsecutivedayspassuntilVasyarunsoutofsocks?InputThesin...
近期评论