TheR2companyhas n employeesworkingforit.Theworkinvolvesconstantexchangeofideas,sharingthestoriesofsuccessandupcomingchallenging.Forthat,R2usesafamousinstantmessagingprogramSpyke.R2has m Spykechatsjusttodiscussallsortsofissues.Ineachchat,somegroupofemployeesexchangesmessagesdaily.Anemployeecansimultaneouslytalkinmultiplechats.Ifsomeemployeeisinthe k-thchat,hecanwritemessagestothisch...
NotsolongagocompanyR2boughtcompanyR1andconsequently,allitsdevelopmentsinthefieldofmulticoreprocessors.NowtheR2laboratoryistestingoneoftheR1processors.Thetestinggoesin n steps,ateachsteptheprocessorgetssomeinstructions,andthenitstemperatureismeasured.TheheadengineerinR2iskeepingareportrecordontheworkoftheprocessor:hewritesdowntheminimumandthemaximummeasuredtemperatureinhisnotebook.Hisas...
OneofthemostimportantproductsoftheR1companyisapopular@r1.commailservice.TheR1mailboxesreceiveandsendmillionsofemailseveryday.Today,theonlinenewsthunderedwithterribleinformation.TheR1databasecrashedandalmostnodatacouldbesavedexceptforonebigstring.ThedevelopersassumethatthestringcontainsthelettersofsomeusersoftheR1mail.Recoveringlettersisatediousmostlymanualwork.Sobeforeyoustartthisproces...
Developersoftenfacewithregularexpressionpatterns.Apatternisusuallydefinedasastringconsistingofcharactersandmetacharactersthatsetstherulesforyoursearch.Thesepatternsaremostoftenusedtocheckwhetheraparticularstringmeetsthecertainrules.Inthistask,apatternwillbeastringconsistingofsmallEnglishlettersandquestionmarks('?').Thequestionmarkinthepatternisametacharacterthatdenotesanarbitrarysmalllettero...
TheR1companywantstoholdawebsearchchampionship.Therewere n computersgivenforthecompetition,eachofthemisconnectedtotheInternet.Theorganizersbelievethatthedatatransferspeeddirectlyaffectstheresult.ThehigherthespeedoftheInternetis,thefastertheparticipantwillfindthenecessaryinformation.Therefore,beforethecompetitionstarted,eachcomputerhaditsmaximumpossibledatatransferspeedmeasured.Onthe i-t...
TheR1companyhasrecentlyboughtahighrisebuildinginthecentreofMoscowforitsmainoffice.It'stimetodecoratethenewoffice,andthefirstthingtodoistowritethecompany'ssloganabovethemainentrancetothebuilding.Thesloganofthecompanyconsistsof n characters,sothedecoratorshungalargebanner, n meterswideand 1 meterhigh,dividedinto n equalsquares.Thefirstcharacterofthesloganmustbeinthefirstsquare(theleftm...
Oneday,atthe"RussianCodeCup"eventitwasdecidedtoplayfootballasanoutofcompetitionevent.Allparticipantswasdividedinto n teamsandplayedseveralmatches,twoteamscouldnotplayagainsteachothermorethanonce.TheappointedJudgewasthemostexperiencedmember—Pavel.Butsincehewasthewisestofall,hesoongotboredofthegameandfellasleep.Wakingup,hediscoveredthatthetournamentisoverandtheteamswanttoknowtheresultso...
Duringthe"RussianCodeCup"programmingcompetition,thetestingsystemstoresallsentsolutionsforeachparticipant.Weknowthatmanyparticipantsuserandomnumbersintheirprogramsandareoftensentseveralsolutionswiththesamesourcecodetocheck.Eachparticipantisidentifiedbysomeuniquepositiveinteger k,andeachsentsolution A ischaracterizedbytwonumbers: x —thenumberofdifferentsolutionsthataresentbeforethefirst...
Mashmokhworksinafactory.Attheendofeachdayhemustturnoffallofthelights.Thelightsonthefactoryareindexedfrom 1 to n.Thereare n buttonsinMashmokh'sroomindexedfrom 1 to n aswell.IfMashmokhpushesbuttonwithindex i,theneachlightwithindexnotlessthani thatisstillturnedonturnsoff.Mashmokhisnotveryclever.Soinsteadofpushingthefirstbuttonhepushessomeofthebuttonsrandomlyeachnight.Hepushed m ...
DescriptionEverthematuringbusinessman,FarmerJohnrealizesthathemustmanagehistimeeffectively.HehasNjobsconvenientlynumbered1..N(1<=N<=1,000)toaccomplish(likemilkingthecows,cleaningthebarn,mendingthefences,andsoon).Tomanagehistimeeffectively,hehascreatedalistofthejobsthatmustbefinished.JobirequiresacertainamountoftimeT_i(1<=T_i<=1,000)tocompleteandfurthermoremustbefinishedbyti...
近期评论