Description(buying.pas/buying.in/buying.out128M1S)FarmerJohnneedstotraveltotowntopickupK(1<=K<=100)poundsoffeed.DrivingDmileswithKpoundsoffeedinhistruckcostsD*Kcents.ThecountyfeedlothasN(1<=N<=100)stores(convenientlynumbered1..N)thatsellfeed.EachstoreislocatedonasegmentoftheXaxiswhoselengthisE(1<=E<=350).StoreiisatlocationX_i(0<X_i<E)onthenumberlinea...
DescriptionFarmerJohnknowsthatanintellectuallysatisfiedcowisahappycowwhowillgivemoremilk.HehasarrangedabrainyactivityforcowsinwhichtheymanipulateanMxNgrid(1<=M<=15;1<=N<=15)ofsquaretiles,eachofwhichiscoloredblackononesideandwhiteontheotherside.Asonewouldguess,whenasinglewhitetileisflipped,itchangestoblack;whenasingleblacktileisflipped,itchangestowhite.Thecowsarerewardedwhenth...
Youaregivenarectangulargridoflatticepointsfrom (0, 0) to (n, m) inclusive.Youhavetochooseexactly4differentpointstobuildapolylinepossiblywithself-intersectionsandself-touching.Thispolylineshouldbeaslongaspossible.Apolylinedefinedbypoints p1, p2, p3, p4 consistsofthelinesegments p1 p2, p2 p3, p3 p4,anditslengthisthesumofthelengthsoftheindividuallinesegments.InputTheonlylineoft...
YouaresolvingthecrosswordproblemKfromIPSC2014.Yousolvedallthecluesexceptforone:whodoesEeveeevolveinto?Youarenotveryintopokemons,butquickgooglinghelpedyoufindout,thatEeveecanevolveintoeightdifferentpokemons:Vaporeon,Jolteon,Flareon,Espeon,Umbreon,Leafeon,Glaceon,andSylveon.Youknowthelengthofthewordinthecrossword,andyoualreadyknowsomeletters.Designersofthecrosswordmadesurethatthe...
Thereare n gamesinafootballtournament.Threeteamsareparticipatinginit.Currently k gameshadalreadybeenplayed.Youareanavidfootballfan,butrecentlyyoumissedthewhole k games.Fortunately,yourememberaguessofyourfriendforthese kgames.Yourfrienddidnottellexactnumberofwinsofeachteam,insteadhethoughtthatabsolutedifferencebetweennumberofwinsoffirstandsecondteamwillbe d1 andthatofbetweensecondand...
Beingaprogrammer,youlikearraysalot.Foryourbirthday,yourfriendshavegivenyouanarray a consistingof n distinct integers.Unfortunately,thesizeof a istoosmall.Youwantabiggerarray!Yourfriendsagreetogiveyouabiggerarray,butonlyifyouareabletoanswerthefollowingquestioncorrectly:isitpossibletosortthearray a (inincreasingorder)byreversing exactlyone segmentof a?Seedefinitionsofsegmentandreve...
DescriptionEveryyearthecowsholdaneventfeaturingapeculiarversionofhopscotchthatinvolvescarefullyjumpingfromrocktorockinariver.Theexcitementtakesplaceonalong,straightriverwitharockatthestartandanotherrockattheend,Lunitsawayfromthestart(1<=L<=1,000,000,000).Alongtheriverbetweenthestartingandendingrocks,N(0<=N<=50,000)morerocksappear,eachatanintegraldistanceDifromthestart(0<Di...
近期评论