DescriptionGivenasetofsticksofvariouslengths,isitpossibletojointhemend-to-endtoformasquare?InputThefirstlineofinputcontainsN,thenumberoftestcases.Eachtestcasebeginswithaninteger4<=M<=20,thenumberofsticks.Mintegersfollow;eachgivesthelengthofastick-anintegerbetween1and10,000.OutputForeachcase,outputalinecontaining"yes"ifisispossibletoformasquare;otherwiseoutput"no".SampleInput[cray...
DescriptionTeacherMaihasakingdom.Amonsterhasinvadedthiskingdom,andTeacherMaiwantstokillit.MonsterinitiallyhashHP.AnditwilldieifHPislessthan1.TeacherMaiandmonstertaketurnstodotheiraction.Inoneround,TeacherMaicanattackthemonstersothattheHPofthemonsterwillbereducedbya.Attheendofthisround,theHPofmonsterwillbeincreasedbyb.Afterkconsecutiveround'sattack,TeacherMaimusttakearestin...
JohnDoeofferedhissisterJaneDoefindthegcdofsomesetofnumbersa.Gcdisapositiveintegerg,suchthatallnumberfromthesetareevenlydivisiblebygandthereisn'tsuchg'(g' > g),thatallnumbersofthesetareevenlydivisiblebyg'.UnfortunatelyJanecouldn'tcopewiththetaskandJohnofferedhertofindtheghdofthesamesubsetofnumbers.Ghdisapositiveintegerg,suchthatatleasthalfofnumbersfromthesetareevenlydivisiblebygandthe...
ShusekiKingdomistheworld'sleadingnationforinnovationandtechnology.Therearencitiesinthekingdom,numberedfrom1ton.ThankstoMr.Kitayuta'sresearch,ithasfinallybecomepossibletoconstructteleportationpipesbetweentwocities.Ateleportationpipewillconnecttwocitiesunidirectionally,thatis,ateleportationpipefromcityxtocityycannotbeusedtotravelfromcityytocityx.Thetransportationwithineachcityisextremelydeve...
TheShusekiIslandsareanarchipelagoof30001smallislandsintheYutampoSea.Theislandsareevenlyspacedalongaline,numberedfrom0to30000fromthewesttotheeast.Theseislandsareknowntocontainmanytreasures.TherearengemsintheShusekiIslandsintotal,andthei-thgemislocatedonislandpi.Mr.Kitayutahasjustarrivedatisland0.Withhisgreatjumpingability,hewillrepeatedlyperformjumpsbetweenislandstotheeastaccordingtoth...
近期评论