![「BZOJ1753」[Usaco2005 qua] Who's in the Middle](http://hzwer.com/wp-content/themes/ly/image/image_post/2014-12-10_11-21-19.jpg)
DescriptionFJissurveyinghisherdtofindthemostaveragecow.Hewantstoknowhowmuchmilkthis'median'cowgives:halfofthecowsgiveasmuchormorethanthemedian;halfgiveasmuchorless.GivenanoddnumberofcowsN(1<=N<10,000)andtheirmilkoutput(1..1,000,000),findthemedianamountofmilkgivensuchthatatleasthalfthecowsgivethesameamountofmilkormoreandatleasthalfgivethesameorless.输入N个数,输出升序排列后中间那个数.I...

ThefinalroundofBayanProgrammingContestwillbeheldinTehran,andtheparticipantswillbecarriedaroundwithayellowbus.Thebushas34passengerseats:4seatsinthelastrowand3seatsinremainingrows.Theeventcoordinatorhasalistofkparticipantswhoshouldbepickedupattheairport.Whenaparticipantgetsonthebus,hewillsitinthelastrowwithanemptyseat.Ifthereismorethanoneemptyseatinthatrow,hewilltaketheleftmostone.Inordert...

TwopolarbearsMenshykovandUsladafromtheSt.PetersburgzooandelephantHoracefromtheKievzoogotsixstickstoplaywithandassesstheanimals'creativity.Menshykov,UsladaandHoracedecidedtomakeeitheranelephantorabearfromthosesticks.Theycanmakeananimalfromsticksinthefollowingway:Foursticksrepresenttheanimal'slegs,thesesticksshouldhavethesamelength.Tworemainingsticksrepresenttheanimal'sheadandbody.Theb...

Tokeepprivacyofmessagesandpreventthealiensfromreadingthem,wemayusevariousencryptionalgorithms.Thesealgorithmsencodeamessageintotheso-calledciphertextthatisdifficult(orimpossible)todecodeforanyoneelsethantheintendedrecipient.Transpositionciphersareatypeofencryptionthatdonotchangethelettersofthemessagebutonlychangetheirorder(“shuffle”theletters).Ofcourse,theshufflingmustbereversibletoallowlate...

GeorgehasrecentlyenteredtheBSUCP(BerlandStateUniversityforCoolProgrammers).GeorgehasafriendAlexwhohasalsoenteredtheuniversity.Nowtheyaremovingintoadormitory.GeorgeandAlexwanttoliveinthesameroom.Thedormitoryhasnroomsintotal.Atthemomentthei-throomhaspipeoplelivinginitandtheroomcanaccommodateqipeopleintotal(pi ≤ qi).YourtaskistocounthowmanyroomshasfreeplaceforbothGeorgeandAlex...

Annhasrecentlystartedcommutingbysubway.Weknowthataoneridesubwayticketcostsarubles.Besides,Annfoundoutthatshecanbuyaspecialticketformrides(shecanbuyitseveraltimes).Itcostsbrubles.Anndidthemath;shewillneedtousesubwayntimes.HelpAnn,tellherwhatistheminimumsumofmoneyshewillhavetospendtomakenrides?InputThesinglelinecontainsfourspace-separatedintegersn,m,a,b(1 ≤ n, m, a, b ≤ 1000)—the...
近期评论