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...
近期评论