DescriptionLukewantstoupgradehishomecomputernetworkfrom10mbsto100mbs.Hisexistingnetworkuses10base2(coaxial)cablesthatallowyoutoconnectanynumberofcomputerstogetherinalineararrangement.LukeisparticularyproudthathesolvedanastyNP-completeprobleminordertominimizethetotalcablelength.Unfortunately,Lukecannotusehisexistingcabling.The100mbssystemuses100baseT(twistedpair)cables.Each100baseTcable...
DescriptionTheinputcontainsNnatural(i.e.positiveinteger)numbers(N<=10000).Eachofthatnumbersisnotgreaterthan15000.Thisnumbersarenotnecessarilydifferent(soitmayhappenthattwoormoreofthemwillbeequal).Yourtaskistochooseafewofgivennumbers(1<=few<=N)sothatthesumofchosennumbersismultipleforN(i.e.N*k=(sumofchosennumbers)forsomenaturalnumberk).InputThefirstlineoftheinputcontainsthesingl...
PeopleintheTomskayaregionlikemagicformulasverymuch.Youcanseesomeofthembelow.Imagineyouaregivenasequenceofpositiveintegernumbers p1, p2,..., pn.Letswritedownsomemagicformulas:Here,"mod"meanstheoperationoftakingtheresidueafterdividing.Theexpression meansapplyingthebitwise xor (excluding"OR")operationtointegers x and y.Thegivenoperationexistsinallmodernprogramminglanguages.Forex...
BimokhisMashmokh'sboss.Forthefollowing n dayshedecidedtopaytohisworkersinanewway.Atthebeginningofeachdayhewillgiveeachworkeracertainamountoftokens.Thenattheendofeachdayeachworkercangivesomeofhistokensbacktogetacertainamountofmoney.Theworkercansavetherestoftokensbuthecan'tuseitinanyotherdaytogetmoremoney.Ifaworkergivesback w tokensthenhe'llget dollars.Mashmokhlikesthetokenshoweverhel...
近期评论