DescriptionIntheFibonacciintegersequence, F0 =0, F1 =1,and Fn = Fn −1 + Fn −2 for n ≥2.Forexample,thefirsttentermsoftheFibonaccisequenceare:0,1,1,2,3,5,8,13,21,34,…AnalternativeformulafortheFibonaccisequenceis.Givenaninteger n,yourgoalistocomputethelast4digitsof Fn.InputTheinputtestfilewillcontainmultipletestcases.Eachtestcaseconsistsofasinglelinecontainingn(wh...
DescriptionIn1742,ChristianGoldbach,aGermanamateurmathematician,sentalettertoLeonhardEulerinwhichhemadethefollowingconjecture:Everyevennumbergreaterthan4canbewrittenasthesumoftwooddprimenumbers.Forexample:8=3+5.Both3and5areoddprimenumbers.20=3+17=7+13.42=5+37=11+31=13+29=19+23.Todayitisstillunprovenwhethertheconjectureisright.(Ohwait,Ihavetheproofofcourse,butitistoolongtowriteitonthem...
DescriptionAliceandBobdecidetoplayanewstonegame.Atthebeginningofthegametheypickn(1<=n<=10)pilesofstonesinaline.AliceandBobmovethestonesinturn.Ateachstepofthegame,theplayerchooseapile,removeatleastonestones,thenfreelymovestonesfromthispiletoanyotherpilethatstillhasstones.Forexample:n=4andthepileshave(3,1,4,2)stones.Iftheplayerchosethefirstpileandremoveone.Thenitcanreachthefollowstat...
DescriptionHereisasimplegame.Inthisgame,thereareseveralpilesofmatchesandtwoplayers.Thetwoplayerplayinturn.Ineachturn,onecanchooseapileandtakeawayarbitrarynumberofmatchesfromthepile(Ofcoursethenumberofmatches,whichistakenaway,cannotbezeroandcannotbelargerthanthenumberofmatchesinthechosenpile).Ifafteraplayer’sturn,thereisnomatchleft,theplayeristhewinner.Supposethatthetwoplayersareallverycle...
近期评论