Optiversponsoredproblem.AfteryearsofhardworkOptiverhasdevelopedamathematicalmodelthatallowsthemtopredictwetherornotacompanywillbesuccesful.Thisobviouslygivesthemagreatadvantageonthestockmarket.Inthepast,Optivermadeadealwithabigcompany,whichforcesthemtobuysharesofthecompanyaccordingtoafixedschedule.Unfortunately,Optiver’smodelhasdeterminedthatthecompanywillgobankruptafterexactlyndays,after...
Youhaverred,ggreenandbblueballoons.Todecorateasingletableforthebanquetyouneedexactlythreeballoons.Threeballoonsattachedtosometableshouldn'thavethesamecolor.Whatmaximumnumbertoftablescanbedecoratedifweknownumberofballoonsofeachcolor?Yourtaskistowriteaprogramthatforgivenvaluesr,gandbwillfindthemaximumnumbertoftables,thatcanbedecoratedintherequiredmanner.InputThesinglelinecontainsthreeintegers...
Dreamoonlikestoplaywithsets,integersand.isdefinedasthelargestpositiveintegerthatdividesbothaandb.LetSbeasetofexactlyfourdistinctintegersgreaterthan0.DefineStobeofrankkifandonlyifforallpairsofdistinctelementssi,sjfromS,.Givenkandn,Dreamoonwantstomakeupnsetsofrankkusingintegersfrom1tomsuchthatnointegerisusedintwodifferentsets(ofcourseyoucanleavesomeintegerswithoutuse).Calculatetheminimummth...
Givenasequenceofintegersa1, ..., anandqqueriesx1, ..., xqonit.Foreachqueryxiyouhavetocountthenumberofpairs(l, r)suchthat1 ≤ l ≤ r ≤ nandgcd(al, al + 1, ..., ar) = xi.isagreatestcommondivisorofv1, v2, ..., vn,thatisequaltoalargestpositiveintegerthatdividesallvi.InputThefirstlineoftheinputcontainsintegern,(1 ≤ n ≤ 105),denotingthelengthofthesequence.Thenextlinecont...
ThefinalroundofBayanProgrammingContestwillbeheldinTehran,andtheparticipantswillbecarriedaroundwithayellowbus.Thebushas34passengerseats:4seatsinthelastrowand3seatsinremainingrows.Theeventcoordinatorhasalistofkparticipantswhoshouldbepickedupattheairport.Whenaparticipantgetsonthebus,hewillsitinthelastrowwithanemptyseat.Ifthereismorethanoneemptyseatinthatrow,hewilltaketheleftmostone.Inordert...
近期评论