ACM程序题目Word文件下载.docx

上传人:b****4 文档编号:7862593 上传时间:2023-05-09 格式:DOCX 页数:41 大小:81.15KB
下载 相关 举报
ACM程序题目Word文件下载.docx_第1页
第1页 / 共41页
ACM程序题目Word文件下载.docx_第2页
第2页 / 共41页
ACM程序题目Word文件下载.docx_第3页
第3页 / 共41页
ACM程序题目Word文件下载.docx_第4页
第4页 / 共41页
ACM程序题目Word文件下载.docx_第5页
第5页 / 共41页
ACM程序题目Word文件下载.docx_第6页
第6页 / 共41页
ACM程序题目Word文件下载.docx_第7页
第7页 / 共41页
ACM程序题目Word文件下载.docx_第8页
第8页 / 共41页
ACM程序题目Word文件下载.docx_第9页
第9页 / 共41页
ACM程序题目Word文件下载.docx_第10页
第10页 / 共41页
ACM程序题目Word文件下载.docx_第11页
第11页 / 共41页
ACM程序题目Word文件下载.docx_第12页
第12页 / 共41页
ACM程序题目Word文件下载.docx_第13页
第13页 / 共41页
ACM程序题目Word文件下载.docx_第14页
第14页 / 共41页
ACM程序题目Word文件下载.docx_第15页
第15页 / 共41页
ACM程序题目Word文件下载.docx_第16页
第16页 / 共41页
ACM程序题目Word文件下载.docx_第17页
第17页 / 共41页
ACM程序题目Word文件下载.docx_第18页
第18页 / 共41页
ACM程序题目Word文件下载.docx_第19页
第19页 / 共41页
ACM程序题目Word文件下载.docx_第20页
第20页 / 共41页
亲,该文档总共41页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

ACM程序题目Word文件下载.docx

《ACM程序题目Word文件下载.docx》由会员分享,可在线阅读,更多相关《ACM程序题目Word文件下载.docx(41页珍藏版)》请在冰点文库上搜索。

ACM程序题目Word文件下载.docx

99.999)andnisanintegersuchthat0<

n<

=25.

Input

TheinputwillconsistofasetofpairsofvaluesforRandn.TheRvaluewilloccupycolumns1through6,andthenvaluewillbeincolumns8and9.

Output

TheoutputwillconsistofonelineforeachlineofinputgivingtheexactvalueofR^n.Leadingzerosshouldbesuppressedintheoutput.Insignificanttrailingzerosmustnotbeprinted.Don'

tprintthedecimalpointiftheresultisaninteger.

SampleInput

95.12312

0.432120

5.123415

6.75929

98.99910

1.010012

SampleOutput

548815*********830194541.899025343415715973535967221869852721

.00000005148554641076956121994511276767154838481760200726351203835429763013462401

43992025569.928573701266488041146654993318703707511666295476720493953024

29448126.764121021618164430206909037173276672

90429072743629540498.107596019456651774561044010001

1.126825*********720661201

Hint

Ifyoudon'

tknowhowtodeterminewheatherencountedtheendofinput:

isastringand 

isaninteger 

C++

while(cin>

>

s>

n)

{

...

}

c

while(scanf("

%s%d"

s,&

n)==2)//toseeifthescanfreadinasmanyitemsasyouwant

/*while(scanf(%s%d"

n)!

=EOF)//thisalsowork*/

1002(17%)

487-3279

2000MS

65536K

166172

28392

Businessesliketohavememorabletelephonenumbers.Onewaytomakeatelephonenumbermemorableistohaveitspellamemorablewordorphrase.Forexample,youcancalltheUniversityofWaterloobydialingthememorableTUT-GLOP.Sometimesonlypartofthenumberisusedtospellaword.WhenyougetbacktoyourhoteltonightyoucanorderapizzafromGino'

sbydialing310-GINO.Anotherwaytomakeatelephonenumbermemorableistogroupthedigitsinamemorableway.YoucouldorderyourpizzafromPizzaHutbycallingtheir``threetens'

'

number3-10-10-10. 

Thestandardformofatelephonenumberissevendecimaldigitswithahyphenbetweenthethirdandfourthdigits(e.g.888-1200).Thekeypadofaphonesuppliesthemappingofletterstonumbers,asfollows:

A,B,andCmapto2 

D,E,andFmapto3 

G,H,andImapto4 

J,K,andLmapto5 

M,N,andOmapto6 

P,R,andSmapto7 

T,U,andVmapto8 

W,X,andYmapto9 

ThereisnomappingforQorZ.Hyphensarenotdialed,andcanbeaddedandremovedasnecessary.ThestandardformofTUT-GLOPis888-4567,thestandardformof310-GINOis310-4466,andthestandardformof3-10-10-10is310-1010. 

Twotelephonenumbersareequivalentiftheyhavethesamestandardform.(Theydialthesamenumber.) 

Yourcompanyiscompilingadirectoryoftelephonenumbersfromlocalbusinesses.Aspartofthequalitycontrolprocessyouwanttocheckthatnotwo(ormore)businessesinthedirectoryhavethesametelephonenumber. 

Theinputwillconsistofonecase.Thefirstlineoftheinputspecifiesthenumberoftelephonenumbersinthedirectory(upto100,000)asapositiveintegeraloneontheline.Theremaininglineslistthetelephonenumbersinthedirectory,witheachnumberaloneonaline.Eachtelephonenumberconsistsofastringcomposedofdecimaldigits,uppercaseletters(excludingQandZ)andhyphens.Exactlysevenofthecharactersinthestringwillbedigitsorletters. 

Generatealineofoutputforeachtelephonenumberthatappearsmorethanonceinanyform.Thelineshouldgivethetelephonenumberinstandardform,followedbyaspace,followedbythenumberoftimesthetelephonenumberappearsinthedirectory.Arrangetheoutputlinesbytelephonenumberinascendinglexicographicalorder.Iftherearenoduplicatesintheinputprinttheline:

Noduplicates. 

12

4873279

ITS-EASY

888-4567

3-10-10-10

888-GLOP

TUT-GLOP

967-11-11

310-GINO

F101010

888-1200

-4-8-7-3-2-7-9-

310-10102

487-32794

888-45673

1006(30%)

Biorhythms

1000MS

81827

24704

Somepeoplebelievethattherearethreecyclesinaperson'

slifethatstartthedayheorsheisborn.Thesethreecyclesarethephysical,emotional,andintellectualcycles,andtheyhaveperiodsoflengths23,28,and33days,respectively.Thereisonepeakineachperiodofacycle.Atthepeakofacycle,apersonperformsathisorherbestinthecorrespondingfield(physical,emotionalormental).Forexample,ifitisthementalcurve,thoughtprocesseswillbesharperandconcentrationwillbeeasier. 

Sincethethreecycleshavedifferentperiods,thepeaksofthethreecyclesgenerallyoccuratdifferenttimes.Wewouldliketodeterminewhenatriplepeakoccurs(thepeaksofallthreecyclesoccurinthesameday)foranyperson.Foreachcycle,youwillbegiventhenumberofdaysfromthebeginningofthecurrentyearatwhichoneofitspeaks(notnecessarilythefirst)occurs.Youwillalsobegivenadateexpressedasthenumberofdaysfromthebeginningofthecurrentyear.Youtaskistodeterminethenumberofdaysfromthegivendatetothenexttriplepeak.Thegivendateisnotcounted.Forexample,ifthegivendateis10andthenexttriplepeakoccursonday12,theansweris2,not3.Ifatriplepeakoccursonthegivendate,youshouldgivethenumberofdaystothenextoccurrenceofatriplepeak. 

Youwillbegivenanumberofcases.Theinputforeachcaseconsistsofonelineoffourintegersp,e,i,andd.Thevaluesp,e,andiarethenumberofdaysfromthebeginningofthecurrentyearatwhichthephysical,emotional,andintellectualcyclespeak,respectively.Thevaluedisthegivendateandmaybesmallerthananyofp,e,ori.Allvaluesarenon-negativeandatmost365,andyoumayassumethatatriplepeakwilloccurwithin21252daysofthegivendate.Theendofinputisindicatedbyalineinwhichp=e=i=d=-1.

Foreachtestcase,printthecasenumberfollowedbyamessageindicatingthenumberofdaystothenexttriplepeak,intheform:

Case1:

thenexttriplepeakoccursin1234days. 

Usethepluralform``days'

eveniftheansweris1.

0000

000100

52034325

4567

28310223320

20330120340

-1-1-1-1

thenexttriplepeakoccursin21252days.

Case2:

thenexttriplepeakoccursin21152days.

Case3:

thenexttriplepeakoccursin19575days.

Case4:

thenexttriplepeakoccursin16994days.

Case5:

thenexttriplepeakoccursin8910days.

Case6:

thenexttriplepeakoccursin10789days.

1009(21%)

EdgeDetection

11467

2445

IONUSatelliteImaging,Inc.recordsandstoresverylargeimagesusingrunlengthencoding.Youaretowriteaprogramthatreadsacompressedimage,findstheedgesintheimage,asdescribedbelow,andoutputsanothercompressedimageofthedetectededges. 

Asimpleedgedetectionalgorithmsetsanoutputpixel'

svaluetobethemaximumabsolutevalueofthedifferencesbetweenitandallitssurroundingpixelsintheinputimage.Considertheinputimagebelow:

Theupperleftpixelintheoutputimageisthemaximumofthevalues|15-15|,|15-100|,and|15-100|,whichis85.Thepixelinthe4throw,2ndcolumniscomputedasthemaximumof|175-100|,|175-100|,|175-100|,|175-175|,|175-25|,|175-175|,|175-175|,and|175-25|,whichis150. 

Imagescontain2to1,000,000,000(109)pixels.Allimagesareencodedusingrunlengthencoding(RLE).Thisisasequenceofpairs,containingpixelvalue(0-255)andrunlength(1-109).Inputimageshaveatmost1,000ofthesepairs.Successivepairshavedifferentpixelvalues.Alllinesinanimagecontainthesamenumberofpixels. 

Inputconsistsofinformationforoneormoreimages.Eachimagestartswiththewidth,inpixels,ofeachimageline.ThisisfollowedbytheRLEpairs,onepairperline.Alinewith00indicatestheendofthedataforthatimage.Animagewidthof0indicatestherearenomoreimagestoprocess.Thefirstimageintheexampleinputencodesthe5x7inputimageabove. 

Outputisaseriesofedge-detectedimages,inthesameformatastheinputimages,exceptthattheremaybemorethan1,000RLEpairs. 

7

154

10015

252

1752

255

00

10

35500000000

200500000000

3

2551

101

2552

855

02

7510

1502

753

04

0499999990

16520

2459

Abruteforcesolutionthatattemptstocomputeanoutputvalueforeveryindividualpixelwilllikelyfailduetospaceortimeconstraints. 

1007(39%)

DNASorting

57392

22516

Onemeasureof``unsortedness'

inasequenceisthenumberofpairsofentriesthatareoutoforderwithrespecttoeachother.Forinstance,inthelettersequence``DAABEC'

thismeasureis5,sinceDisgreaterthanfourletterstoitsrightandEisgreaterthanonelettertoitsright.Thismeasureiscalledthenumberofinversionsinthesequence.Thesequence``AACEDGG'

hasonlyoneinversion(EandD)---itisnearlysorte

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 法律文书 > 起诉状

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2