数学.docx
《数学.docx》由会员分享,可在线阅读,更多相关《数学.docx(43页珍藏版)》请在冰豆网上搜索。
![数学.docx](https://file1.bdocx.com/fileroot1/2023-1/10/d2be5406-d6a2-48a5-a964-9f3d33c862cc/d2be5406-d6a2-48a5-a964-9f3d33c862cc1.gif)
数学
数学
数学
1018BigNumber
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
26720 AcceptedSubmission(s):
12156
ProblemDescription
Inmanyapplicationsverylargeintegersnumbersarerequired.Someoftheseapplicationsareusingkeysforsecuretransmissionofdata,encryption,etc.Inthisproblemyouaregivenanumber,youhavetodeterminethenumberofdigitsinthefactorialofthenumber.
Input
Inputconsistsofseverallinesofintegernumbers.Thefirstlinecontainsanintegern,whichisthenumberofcasestobetested,followedbynlines,oneinteger1≤n≤107oneachline.
Output
Theoutputcontainsthenumberofdigitsinthefactorialoftheintegersappearingintheinput.
SampleInput
2
10
20
SampleOutput
7
19
1028IgnatiusandthePrincessIII
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
13512 AcceptedSubmission(s):
9558
ProblemDescription
"Well,itseemsthefirstproblemistooeasy.Iwillletyouknowhowfoolishyouarelater."feng5166says.
"Thesecondproblemis,givenanpositiveintegerN,wedefineanequationlikethis:
N=a[1]+a[2]+a[3]+...+a[m];
a[i]>0,1<=m<=N;
MyquestionishowmanydifferentequationsyoucanfindforagivenN.
Forexample,assumeNis4,wecanfind:
4=4;
4=3+1;
4=2+2;
4=2+1+1;
4=1+1+1+1;
sotheresultis5whenNis4.Notethat"4=3+1"and"4=1+3"isthesameinthisproblem.Now,youdoit!
"
Input
Theinputcontainsseveraltestcases.EachtestcasecontainsapositiveintegerN(1<=N<=120)whichismentionedabove.Theinputisterminatedbytheendoffile.
Output
Foreachtestcase,youhavetooutputalinecontainsanintegerPwhichindicatethedifferentequationsyouhavefound.
SampleInput
4
10
20
SampleOutput
5
42
627
1056HangOver
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
9720 AcceptedSubmission(s):
4096
ProblemDescription
Howfarcanyoumakeastackofcardsoverhangatable?
Ifyouhaveonecard,youcancreateamaximumoverhangofhalfacardlength.(We'reassumingthatthecardsmustbeperpendiculartothetable.)Withtwocardsyoucanmakethetopcardoverhangthebottomonebyhalfacardlength,andthebottomoneoverhangthetablebyathirdofacardlength,foratotalmaximumoverhangof1/2+1/3=5/6cardlengths.Ingeneralyoucanmakencardsoverhangby1/2+1/3+1/4+...+1/(n+1)cardlengths,wherethetopcardoverhangsthesecondby1/2,thesecondoverhangsthathirdby1/3,thethirdoverhangsthefourthby1/4,etc.,andthebottomcardoverhangsthetableby1/(n+1).Thisisillustratedinthefigurebelow.
Theinputconsistsofoneormoretestcases,followedbyalinecontainingthenumber0.00thatsignalstheendoftheinput.Eachtestcaseisasinglelinecontainingapositivefloating-pointnumbercwhosevalueisatleast0.01andatmost5.20;cwillcontainexactlythreedigits.
Foreachtestcase,outputtheminimumnumberofcardsnecessarytoachieveanoverhangofatleastccardlengths.Usetheexactoutputformatshownintheexamples.
SampleInput
1.00
3.71
0.04
5.19
0.00
SampleOutput
3card(s)
61card(s)
1card(s)
273card(s)
1060LeftmostDigit
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
13545 AcceptedSubmission(s):
5208
ProblemDescription
GivenapositiveintegerN,youshouldoutputtheleftmostdigitofN^N.
Input
Theinputcontainsseveraltestcases.ThefirstlineoftheinputisasingleintegerTwhichisthenumberoftestcases.Ttestcasesfollow.
EachtestcasecontainsasinglepositiveintegerN(1<=N<=1,000,000,000).
Output
Foreachtestcase,youshouldoutputtheleftmostdigitofN^N.
SampleInput
2
3
4
SampleOutput
2
2
Hint
Inthefirstcase,3*3*3=27,sotheleftmostdigitis2.
Inthesecondcase,4*4*4*4=256,sotheleftmostdigitis2.
1066Lastnon-zeroDigitinN!
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
6337 AcceptedSubmission(s):
1567
ProblemDescription
TheexpressionN!
readas"Nfactorial,"denotestheproductofthefirstNpositiveintegers,whereNisnonnegative.So,forexample,
NN!
01
11
22
36
424
5120
103628800
Forthisproblem,youaretowriteaprogramthatcancomputethelastnon-zerodigitofthefactorialforN.Forexample,ifyourprogramisaskedtocomputethelastnonzerodigitof5!
yourprogramshouldproduce"2"because5!
=120,and2isthelastnonzerodigitof120.
Input
Inputtotheprogramisaseriesofnonnegativeintegers,eachonitsownlinewithnootherletters,digitsorspaces.ForeachintegerN,youshouldreadthevalueandcomputethelastnonzerodigitofN!
.
Output
Foreachintegerinput,theprogramshouldprintexactlyonelineofoutputcontainingthesinglelastnon-zerodigitofN!
.
SampleInput
1
2
26
125
3125
9999
SampleOutput
1
2
4
8
2
8
1071Thearea
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
7855 AcceptedSubmission(s):
5520
ProblemDescription
Ignatiusboughtalandlastweek,buthedidn'tknowtheareaofthelandbecausethelandisenclosedbyaparabolaandastraightline.Thepicturebelowshowsthearea.Nowgivenalltheintersectantpointsshowsinthepicture,canyoutellIgnatiustheareaoftheland?
Note:
ThepointP1inthepictureisthevertexoftheparabola.
Input
Theinputcontainsseveraltestcases.ThefirstlineoftheinputisasingleintegerTwhichisthenumberoftestcases.Ttestcasesfollow.
Eachtestcasecontainsthreeintersectantpointswhichshowsinthepicture,theyaregivenintheorderofP1,P2,P3.Eachpointisdescribedbytwofloating-pointnumbersXandY(0.0<=X,Y<=1000.0).
Output
Foreachtestcase,youshouldoutputtheareaoftheland,theresultshouldberoundedto2decimalplaces.
SampleInput
2
5.0000005.000000
0.0000000.000000
10.0000000.000000
10.00000010.000000
1.0000001.000000
14.0000008.222222
SampleOutput
33.33
40.69
1099Lottery
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
2559 AcceptedSubmission(s):
1158
ProblemDescription
Eddy'scompanypublishesakindoflottery.Thissetoflotterywhicharenumbered1ton,andasetofoneofeachisrequiredforaprize.Withonenumberperlottery,howmanylotteryonaveragearerequiredtomakeacompletesetofncoupons?
Input
Inputconsistsofasequenceoflineseachcontainingasinglepositiveintegern,1<=n<=22,givingthesizeofthesetofcoupons.
Output
Foreachinputline,outputtheaveragenumberoflotteryrequiredtocollectthecompletesetofncoupons.Iftheanswerisanintegernumber,outputthenumber.Iftheanswerisnotinteger,thenoutputtheintegerpartoftheanswerfollowedbyaspaceandthenbytheproperfractionintheformatshownbelow.Thefractionalpartshouldbeirreducible.Thereshouldbenotrailingspacesinanylineofouput.
SampleInput
2
5
17
SampleOutput
3
5
11--
12
340463
58------
720720
1110EquipmentBox
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
1547 AcceptedSubmission(s):
364
ProblemDescription
ThereisalargeroominthePyramidcalledRoom-of-No-Return.Itsflooriscoveredbyrectangulartilesofequalsize.Thenameoftheroomwaschosenbecauseoftheveryhighnumberoftrapsandmechanismsinit.TheACMgrouphasspentseveralyearsstudyingthesecretplanofthisroom.Ithasmadeacleverplantoavoidallthetraps.AspeciallytrainedmechanicwassenttodeactivatethemostfearedtrapcalledShatteredBones.Afterdeactivatingthetrapthemechanichadtoescapefromtheroom.Itisveryimportanttosteponthecenterofthetilesonly;hemustnottouchtheedges.Onewrongstepandalargerockfallsfromtheceilingsquashingthemechaniclikeapancake.Afterdeactivatingthetrap,herealizedahorriblething:
theACMplandidnottakehisequipmentboxintoconsideration.Theboxmustbelaidontothegroundbecausethemechanicmusthavebothhandsfreetopreventcontactwithothertraps.Butwhentheboxislaidontheground,itcouldtouchthelineseparatingthetiles.Andthisisthemainproblemyouaretosolve.
Input
TheinputconsistsofTtestcases.Thenumberofthem(T)isgivenonthefirstlineoftheinput.Eachtestcaseconsistsofasingleline.Thelinecontainsexactlyfourintegernumbersseparatedbyspaces:
A,B,XandY.AandBindicatethedimensionsofthetiles,XandYarethedimensionsoftheequipmentbox(1<=A,B,X,Y<=50000).
Output
Yourtaskistodeterminewhetheritispossibletoputtheboxonasingletile--thatis,ifthewholeboxfitsonasingletilewithouttouchingitsborder.Ifso,youaretoprintonelinewiththesentence"Escapeispossible.".Otherwiseprintthesentence"Boxcannotbedropped.".
SampleInput
2
101088
881010
SampleOutput
Escapeispossible.
Boxcannotbedropped.
1210Eddy's洗牌问题
TimeLimit:
2000/1000MS(Java/Others) MemoryLimit:
65536/32768K(Java/Others)
TotalSubmission(s):
3389 AcceptedSubmission(s):
2275
ProblemDescription
Eddy是个ACMer,他不仅喜欢做ACM题,而且对于纸牌也有一定的研究,他在无聊时研究发现,如果他有2N张牌,编号为1,2,3..n,n+1,..2n。
这也是最初的牌的顺序。
通过一次洗牌可以把牌的序列变为n+1,1,n+2,2,n+3,3,n+4,4..2n,n。
那么可以证明,对于任意自然数N,都可以在经过M次洗牌后第一次重新得到初始