
Mashmokh'sboss,Bimokh,didn'tlikeMashmokh.Sohefiredhim.MashmokhdecidedtogotouniversityandparticipateinACMinsteadoffindinganewjob.HewantstobecomeamemberofBamokh'steam.Inordertojoinhewasgivensomeprogrammingtasksandoneweektosolvethem.Mashmokhisnotaveryexperiencedprogrammer.Actuallyheisnotaprogrammeratall.Sohewasn'tabletosolvethem.That'swhyheaskedyoutohelphimwiththesetasks.Oneofthesetas...

It'sholiday.Mashmokhandhisboss,Bimokh,areplayingagameinventedbyMashmokh.InthisgameMashmokhwritessequenceof n distinctintegersontheboard.ThenBimokhmakesseveral(possiblyzero)moves.Onthefirstmoveheremovesthefirstandthesecondintegerfromfromtheboard,onthesecondmoveheremovesthefirstandthesecondintegeroftheremainingsequencefromtheboard,andsoon.Bimokhstopswhentheboardcontainslessthantwonumbers...

BimokhisMashmokh'sboss.Forthefollowing n dayshedecidedtopaytohisworkersinanewway.Atthebeginningofeachdayhewillgiveeachworkeracertainamountoftokens.Thenattheendofeachdayeachworkercangivesomeofhistokensbacktogetacertainamountofmoney.Theworkercansavetherestoftokensbuthecan'tuseitinanyotherdaytogetmoremoney.Ifaworkergivesback w tokensthenhe'llget dollars.Mashmokhlikesthetokenshoweverhel...

Mashmokhworksinafactory.Attheendofeachdayhemustturnoffallofthelights.Thelightsonthefactoryareindexedfrom 1 to n.Thereare n buttonsinMashmokh'sroomindexedfrom 1 to n aswell.IfMashmokhpushesbuttonwithindex i,theneachlightwithindexnotlessthani thatisstillturnedonturnsoff.Mashmokhisnotveryclever.Soinsteadofpushingthefirstbuttonhepushessomeofthebuttonsrandomlyeachnight.Hepushed m ...
近期评论