Vasyaisstudyinginthelastclassofschoolandsoonhewilltakeexams.Hedecidedtostudypolynomials.PolynomialisafunctionP(x) = a0 + a1x1 + ... + anxn.Numbersaiarecalledcoefficientsofapolynomial,non-negativeintegerniscalledadegreeofapolynomial.Vasyahasmadeabetwithhisfriendsthathecansolveanyproblemwithpolynomials.Theysuggestedhimtheproblem:"DeterminehowmanypolynomialsP(x)existwithintegernon-ne...
Vasyadecidedtolearntoplaychess.Classicchessdoesn'tseeminterestingtohim,soheplayshisownsortofchess.Thequeenisthepiecethatcapturesallsquaresonitsvertical,horizontalanddiagonallines.Ifthecellislocatedonthesamevertical,horizontalordiagonallinewithqueen,andthecellcontainsapieceoftheenemycolor,thequeenisabletomovetothissquare.Afterthattheenemy'spieceisremovedfromtheboard.Thequeencannotmovetoacellc...
Vasyafollowsabasketballgameandmarksthedistancesfromwhicheachteammakesathrow.Heknowsthateachsuccessfulthrowhasvalueofeither2or3points.Athrowisworth2pointsifthedistanceitwasmadefromdoesn'texceedsomevalueofdmeters,andathrowisworth3pointsifthedistanceislargerthandmeters,wheredissomenon-negativeinteger.Vasyawouldliketheadvantageofthepointsscoredbythefirstteam(thepointsofthefirstteamminusthepointsof...
Vasyahasbecomeinterestedinwrestling.Inwrestlingwrestlersusetechniquesforwhichtheyareawardedpointsbyjudges.Thewrestlerwhogetsthemostpointswins.Whenthenumbersofpointsofbothwrestlersareequal,thewrestlerwhosesequenceofpointsislexicographicallygreater,wins.Ifthesequencesoftheawardedpointscoincide,thewrestlerwhoperformedthelasttechniquewins.Yourtaskistodeterminewhichwrestlerwon.InputThefirstline...
Vasyahasstartedwatchingfootballgames.Hehaslearnedthatforsomefoulstheplayersreceiveyellowcards,andforsomefoulstheyreceiveredcards.Aplayerwhoreceivesthesecondyellowcardautomaticallyreceivesaredcard.Vasyaiswatchingarecordedfootballmatchnowandmakesnotesofallthefoulsthathewouldgiveacardfor.HelpVasyadetermineallthemomentsintimewhenplayerswouldbegivenredcardsifVasyawerethejudge.Foreachplayer,Vas...
近期评论