• 「CF440B」Balancer

    「CF440B」Balancer

    Petyahas k matches,placedin n matchboxeslyinginalinefromlefttoright.Weknowthat k isdivisibleby n.Petyawantsallboxestohavethesamenumberofmatchesinside.Forthat,hecanmoveamatchfromitsboxtotheadjacentoneinonemove.Howmanysuchmovesdoesheneedtoachievethedesiredconfiguration?InputThefirstlinecontainsinteger n (1 ≤ n ≤ 50000).Thesecondlinecontains n non-negativenumbersthatdonotexce...

    02014年6月4日2,082模拟
  • 「CF440A」Forgotten Episode

    「CF440A」Forgotten Episode

    PolycarpusadoresTVseries.Rightnowheisreadytofinishwatchingaseasonofapopularsitcom"GraphTheory".Intotal,theseasonhas n episodes,numberedwithintegersfrom 1 to n.Polycarpuswatchesepisodesnotonebyonebutinarandomorder.Hehasalreadywatchedalltheepisodesexceptforone.WhichepisodehasPolycaprusforgottentowatch?InputThefirstlineoftheinputcontainsinteger n (2 ≤ n ≤ 100000) —thenumbe...

    02014年6月4日2,151模拟
  • 「POJ2396」Budget

    「POJ2396」Budget

    DescriptionWearesupposedtomakeabudgetproposalforthismulti-sitecompetition.Thebudgetproposalisamatrixwheretherowsrepresentdifferentkindsofexpensesandthecolumnsrepresentdifferentsites.Wehadameetingaboutthis,sometimeagowherewediscussedthesumsoverdifferentkindsofexpensesandsumsoverdifferentsites.Therewasalsosometalkaboutspecialconstraints:someonementionedthatComputerCenterwouldneedatleast2000K...

    12014年6月3日4,133有上下界网络流
  • 「zoj3229」Shoot the Bullet

    「zoj3229」Shoot the Bullet

    Gensokyo isaworldwhichexistsquietlybesideours,separatedbyamysticalborder.Itisautopiawherehumansandotherbeingssuchasfairies, youkai(phantoms),andgodslivepeacefullytogether.ShameimaruAyaisacrowtenguwiththeabilitytomanipulatewindwhohasbeenin Gensokyo forover1000years.SherunstheBunbunmaruNews-anewspaperchock-fullofrumors,andownsthe Bunkachou -herrecordofinterestingobservationsforBunbun...

    22014年6月3日6,007有上下界网络流
  • 「zoj2314」Reactor Cooling

    「zoj2314」Reactor Cooling

    TheterroristgroupleadedbyawellknowninternationalterroristBenBladenisbulidinganuclearreactortoproduceplutoniumforthenuclearbombtheyareplanningtocreate.Beingthewickedcomputergeniusofthisgroup,youareresponsiblefordevelopingthecoolingsystemforthereactor.Thecoolingsystemofthereactorconsistsofthenumberofpipesthatspecialcoolingliquidflowsby.Pipesareconnectedatspecialpoints,callednodes,eachpipehasth...

    02014年6月3日5,399有上下界网络流
  • 「CF437B」The Child and Set

    「CF437B」The Child and Set

    Atthechildren'sday,thechildcametoPicks'shouse,andmessedhishouseup.Pickswasangryathim.Alotofimportantthingswerelost,inparticularthefavoritesetofPicks.Fortunately,Picksrememberssomethingabouthisset S:itselementsweredistinctintegersfrom 1 to limit;thevalueof  wasequalto sum;here lowbit(x) equals 2k where k isthepositionofthefirstoneinthebinaryrepresentationof x.Forexample, low...

    02014年6月3日2,809贪心
  • 「CF437A」The Child and Homework

    「CF437A」The Child and Homework

    Onceuponatimeachildgotatestconsistingofmultiple-choicequestionsashomework.Amultiple-choicequestionconsistsoffourchoices: A, B, C and D.Eachchoicehasadescription,andthechildshouldfindouttheonlyonethatiscorrect.Fortunatelythechildknowshowtosolvesuchcomplicatedtest.Thechildwillfollowthealgorithm:Ifthereissomechoicewhosedescriptionatleasttwiceshorterthanallotherdescriptions,oratleasttwi...

    02014年6月2日2,385模拟
  • 「CF437D」The Child and Zoo

    「CF437D」The Child and Zoo

    Ofcourseourchildlikeswalkinginazoo.Thezoohas n areas,thatarenumberedfrom 1 to n.The i-thareacontains ai animalsinit.Alsothereare m roadsinthezoo,andeachroadconnectstwodistinctareas.Naturallythezooisconnected,soyoucanreachanyareaofthezoofromanyotherareausingtheroads.Ourchildisverysmart.Imaginethechildwanttogofromarea p toarea q.Firstlyheconsidersallthesimpleroutesfrom p to q...

    42014年6月1日4,177并查集
  • 「CF437C」The Child and Toy

    「CF437C」The Child and Toy

    OnChildren'sDay,thechildgotatoyfromDelayyyasapresent.However,thechildissonaughtythathecan'twaittodestroythetoy.Thetoyconsistsof n partsand m ropes.Eachropelinkstwoparts,buteverypairofpartsislinkedbyatmostonerope.Tosplitthetoy,thechildmustremoveallitsparts.Thechildcanremoveasinglepartatatime,andeachremoveconsumeanenergy.Let'sdefineanenergyvalueofpart i as vi.Thechildspend vf1 + ...

    02014年6月1日619贪心
  • 「POJ2407」Relatives

    「POJ2407」Relatives

    DescriptionGivenn,apositiveinteger,howmanypositiveintegerslessthannarerelativelyprimeton?Twointegersaandbarerelativelyprimeiftherearenointegersx>1,y>0,z>0suchthata=xyandb=xz.InputThereareseveraltestcases.Foreachtestcase,standardinputcontainsalinewithn<=1,000,000,000.Alinecontaining0followsthelastcase.OutputForeachtestcasethereshouldbesinglelineofoutputansweringthequestionposed...

    02014年6月1日3,321欧拉函数
  • NOI2002Robot

    NOI2002Robot

    DescriptionInputOutputSampleInput3213251SampleOutput8675HINT90号机器人有10个老师,加上它自己共11个。其中政客只有15号;军人有3号和5号;学者有8个,它们的编号分别是:2,6,9,10,18,30,45,90。题解为何我觉得这题十分恶心f[i][0]表示前i个因数(不含2)的乘积m和它的老师中政客的独立数之和(包括自己)f[i][1]表示前i个因数(不含2)的乘积m和它的老师中军人的独立数之和(包括自己)[crayon-67a95bf83ee2285996...

    12014年6月1日3,480快速幂,欧拉函数
  • 「POJ2478」Farey Sequence

    「POJ2478」Farey Sequence

    DescriptionTheFareySequenceFnforanyintegernwithn>=2isthesetofirreduciblerationalnumbersa/bwith0<a<b<=nandgcd(a,b)=1arrangedinincreasingorder.ThefirstfewareF2={1/2}F3={1/3,1/2,2/3}F4={1/4,1/3,1/2,2/3,3/4}F5={1/5,1/4,1/3,2/5,1/2,3/5,2/3,3/4,4/5}YoutaskistocalculatethenumberoftermsintheFareysequenceFn.InputThereareseveraltestcases.Eachtestcasehasonlyoneline,whichcontainsap...

    02014年6月1日3,752筛法,欧拉函数
86 / 145 « 上一页 1 ...84 85 86 87 88 ...145 下一页 »