ValeryisaPEteacherataschoolinBerland.Soonthestudentsaregoingtotakeatestinlongjumps,andValeryhaslosthisfavoriteruler!However,thereisnoreasonfordisappointment,asValeryhasfoundanotherruler,itslengthislcentimeters.Theruleralreadyhasnmarks,withwhichhecanmakemeasurements.Weassumethatthemarksarenumberedfrom1tonintheordertheyappearfromthebeginningoftherulertoitsend.Thefirstpointcoincideswiththe...
StudentValeraisanundergraduatestudentattheUniversity.Hisendoftermexamsareapproachingandheistopassexactlynexams.Valeraisasmartguy,sohewillbeabletopassanyexamhetakesonhisfirsttry.Besides,hecantakeseveralexamsononeday,andinanyorder.Accordingtotheschedule,astudentcantaketheexamforthei-thsubjectonthedaynumberai.However,Valerahasmadeanarrangementwitheachteacherandtheteacherofthei-thsubjectallow...
PachinkoisaJapanesegameplayedforamusementandprizes,andissimilartopinball.Thegameisverysimple:youshootsmallmetalballsintothemachineandtheyfalldown,bouncingofftheobstaclesuntiltheyfallintoagate.Thegateintowhichyourballfallsdeterminesthewinnings.Sinceyoucanmoreorlessdeterminethecolumnintowhichtheballisdropped(bysettingitsinitialspeedanddirection),youcaninfluenceyourwinchances.Youaretocalculatey...
Optiversponsoredproblem.AfteryearsofhardworkOptiverhasdevelopedamathematicalmodelthatallowsthemtopredictwetherornotacompanywillbesuccesful.Thisobviouslygivesthemagreatadvantageonthestockmarket.Inthepast,Optivermadeadealwithabigcompany,whichforcesthemtobuysharesofthecompanyaccordingtoafixedschedule.Unfortunately,Optiver’smodelhasdeterminedthatthecompanywillgobankruptafterexactlyndays,after...
Therearerredandggreenblocksforconstructionofthered-greentower.Red-greentowercanbebuiltfollowingnextrules:Red-greentowerisconsistingofsomenumberoflevels;Letthered-greentowerconsistofnlevels,thenthefirstlevelofthistowershouldconsistofnblocks,secondlevel—ofn - 1blocks,thethirdone—ofn - 2blocks,andsoon—thelastlevelofsuchtowershouldconsistoftheoneblock.Inotherwords,eachsuccessivelevelshould...
Youhaverred,ggreenandbblueballoons.Todecorateasingletableforthebanquetyouneedexactlythreeballoons.Threeballoonsattachedtosometableshouldn'thavethesamecolor.Whatmaximumnumbertoftablescanbedecoratedifweknownumberofballoonsofeachcolor?Yourtaskistowriteaprogramthatforgivenvaluesr,gandbwillfindthemaximumnumbertoftables,thatcanbedecoratedintherequiredmanner.InputThesinglelinecontainsthreeintegers...
近期评论