poj ACM题.docx

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

poj ACM题.docx

《poj ACM题.docx》由会员分享,可在线阅读,更多相关《poj ACM题.docx(69页珍藏版)》请在冰点文库上搜索。

poj ACM题.docx

pojACM题

求高精度幂

TimeLimit:

500MS

MemoryLimit:

10000K

TotalSubmissions:

77451

Accepted:

18371

Description

对数值很大、精度很高的数进行高精度计算是一类十分常见的问题。

比如,对国债进行计算就是属于这类问题。

现在要你解决的问题是:

对一个实数R(0.0

Input

T输入包括多组R和n。

R的值占第1到第6列,n的值占第8和第9列。

Output

对于每组输入,要求输出一行,该行包含精确的R的n次方。

输出需要去掉前导的0后不要的0。

如果输出是整数,不要输出小数点。

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

487-3279

TimeLimit:

2000MS

MemoryLimit:

65536K

TotalSubmissions:

145788

Accepted:

24911

Description

企业喜欢用容易被记住的电话号码。

让电话号码容易被记住的一个办法是将它写成一个容易记住的单词或者短语。

例如,你需要给滑铁卢大学打电话时,可以拨打TUT-GLOP。

有时,只将电话号码中部分数字拼写成单词。

当你晚上回到酒店,可以通过拨打310-GINO来向Gino's订一份pizza。

让电话号码容易被记住的另一个办法是以一种好记的方式对号码的数字进行分组。

通过拨打必胜客的“三个十”号码3-10-10-10,你可以从他们那里订pizza。

电话号码的标准格式是七位十进制数,并在第三、第四位数字之间有一个连接符。

电话拨号盘提供了从字母到数字的映射,映射关系如下:

A,B,和C映射到2

D,E,和F映射到3

G,H,和I映射到4

J,K,和L映射到5

M,N,和O映射到6

P,R,和S映射到7

T,U,和V映射到8

W,X,和Y映射到9

Q和Z没有映射到任何数字,连字符不需要拨号,可以任意添加和删除。

TUT-GLOP的标准格式是888-4567,310-GINO的标准格式是310-4466,3-10-10-10的标准格式是310-1010。

如果两个号码有相同的标准格式,那么他们就是等同的(相同的拨号)

你的公司正在为本地的公司编写一个电话号码薄。

作为质量控制的一部分,你想要检查是否有两个和多个公司拥有相同的电话号码。

Input

输入的格式是,第一行是一个正整数,指定电话号码薄中号码的数量(最多100000)。

余下的每行是一个电话号码。

每个电话号码由数字,大写字母(除了Q和Z)以及连接符组成。

每个电话号码中只会刚好有7个数字或者字母。

Output

对于每个出现重复的号码产生一行输出,输出是号码的标准格式紧跟一个空格然后是它的重复次数。

如果存在多个重复的号码,则按照号码的字典升序输出。

如果输入数据中没有重复的号码,输出一行:

Noduplicates.

SampleInput

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-

487-3279

SampleOutput

310-10102

487-32794

888-45673

Hangover

TimeLimit:

1000MS

MemoryLimit:

10000K

TotalSubmissions:

61305

Accepted:

28970

Description

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.

Input

Theinputconsistsofoneormoretestcases,followedbyalinecontainingthenumber0.00thatsignalstheendoftheinput.Eachtestcaseisasinglelinecontainingapositivefloating-pointnumbercwhosevalueisatleast0.01andatmost5.20;cwillcontainexactlythreedigits.

Output

Foreachtestcase,outputtheminimumnumberofcardsnecessarytoachieveanoverhangofatleastccardlengths.Usetheexactoutputformatshownintheexamples.

SampleInput

1.00

3.71

0.04

5.19

0.00

SampleOutput

3card(s)

61card(s)

1card(s)

273card(s)

FinancialManagement

TimeLimit:

1000MS

MemoryLimit:

10000K

TotalSubmissions:

68553

Accepted:

33375

Description

Larrygraduatedthisyearandfinallyhasajob.He'smakingalotofmoney,butsomehowneverseemstohaveenough.Larryhasdecidedthatheneedstograbholdofhisfinancialportfolioandsolvehisfinancingproblems.Thefirststepistofigureoutwhat'sbeengoingonwithhismoney.Larryhashisbankaccountstatementsandwantstoseehowmuchmoneyhehas.HelpLarrybywritingaprogramtotakehisclosingbalancefromeachofthepasttwelvemonthsandcalculatehisaverageaccountbalance.

Input

Theinputwillbetwelvelines.Eachlinewillcontaintheclosingbalanceofhisbankaccountforaparticularmonth.Eachnumberwillbepositiveanddisplayedtothepenny.Nodollarsignwillbeincluded.

Output

Theoutputwillbeasinglenumber,theaverage(mean)oftheclosingbalancesforthetwelvemonths.Itwillberoundedtothenearestpenny,precededimmediatelybyadollarsign,andfollowedbytheend-of-line.Therewillbenootherspacesorcharactersintheoutput.

SampleInput

100.00

489.12

12454.12

1234.10

823.05

109.20

5.27

1542.25

839.18

83.99

1295.01

1.75

SampleOutput

$1581.42

IThinkINeedaHouseboat

TimeLimit:

1000MS

MemoryLimit:

10000K

TotalSubmissions:

55699

Accepted:

23084

Description

FredMapperisconsideringpurchasingsomelandinLouisianatobuildhishouseon.Intheprocessofinvestigatingtheland,helearnedthatthestateofLouisianaisactuallyshrinkingby50squaremileseachyear,duetoerosioncausedbytheMississippiRiver.SinceFredishopingtoliveinthishousetherestofhislife,heneedstoknowifhislandisgoingtobelosttoerosion.

Afterdoingmoreresearch,Fredhaslearnedthatthelandthatisbeinglostformsasemicircle.Thissemicircleispartofacirclecenteredat(0,0),withthelinethatbisectsthecirclebeingtheXaxis.LocationsbelowtheXaxisareinthewater.Thesemicirclehasanareaof0atthebeginningofyear1.(SemicircleillustratedintheFigure.)

Input

Thefirstlineofinputwillbeapositiveintegerindicatinghowmanydatasetswillbeincluded(N).EachofthenextNlineswillcontaintheXandYCartesiancoordinatesofthelandFredisconsidering.Thesewillbefloatingpointnumbersmeasuredinmiles.TheYcoordinatewillbenon-negative.(0,0)willnotbegiven.

Output

Foreachdataset,asinglelineofoutputshouldappear.Thislineshouldtaketheformof:

“PropertyN:

ThispropertywillbeginerodinginyearZ.”WhereNisthedataset(countingfrom1),andZisthefirstyear(startfrom1)thispropertywillbewithinthesemicircleATTHEENDOFYEARZ.Zmustbeaninteger.Afterthelastdataset,thisshouldprintout“ENDOFOUTPUT.”

SampleInput

2

1.01.0

25.00.0

SampleOutput

Property1:

Thispropertywillbeginerodinginyear1.

Property2:

Thispropertywillbeginerodinginyear20.

ENDOFOUTPUT.

Hint

1.Nopropertywillappearexactlyonthesemicircleboundary:

itwilleitherbeinsideoroutside.

2.Thisproblemwillbejudgedautomatically.Youranswermustmatchexactly,includingthecapitalization,punctuation,andwhite-space.Thisincludestheperiodsattheendsofthelines.

3.Alllocationsaregiveninmiles.

生理周期

TimeLimit:

1000MS

MemoryLimit:

10000K

TotalSubmissions:

72976

Accepted:

21737

Description

人生来就有三个生理周期,分别为体力、感情和智力周期,它们的周期长度为23天、28天和33天。

每一个周期中有一天是高峰。

在高峰这天,人会在相应的方面表现出色。

例如,智力周期的高峰,人会思维敏捷,精力容易高度集中。

因为三个周期的周长不同,所以通常三个周期的高峰不会落在同一天。

对于每个人,我们想知道何时三个高峰落在同一天。

对于每个周期,我们会给出从当前年份的第一天开始,到出现高峰的天数(不一定是第一次高峰出现的时间)。

你的任务是给定一个从当年第一天开始数的天数,输出从给定时间开始(不包括给定时间)下一次三个高峰落在同一天的时间(距给定时间的天数)。

例如:

给定时间为10,下次出现三个高峰同天的时间是12,则输出2(注意这里不是3)。

Input

输入四个整数:

p,e,i和d。

p,e,i分别表示体力、情感和智力高峰出现的时间(时间从当年的第一天开始计算)。

d是给定的时间,可能小于p,e,或i。

所有给定时间是非负的并且小于365,所求的时间小于21252。

当p=e=i=d=-1时,输入数据结束。

Output

从给定时间起,下一次三个高峰同天的时间(距离给定时间的天数)。

采用以下格式:

Case1:

thenexttriplepeakoccursin1234days.

注意:

即使结果是1天,也使用复数形式“days”。

SampleInput

0000

000100

52034325

4567

28310223320

20330120340

-1-1-1-1

SampleOutput

Case1:

thenexttriplepeakoccursin21252days.

Case2:

thenexttriplepeakoccursin21152days.

Case3:

thenexttriplepeakoccursin19575days.

Case4:

thenexttriplepeakoccursin16994days.

Case5:

thenexttriplepeakoccursin8910days.

Case6:

thenexttriplepeakoccursin10789days.

DNASorting

TimeLimit:

1000MS

MemoryLimit:

10000K

TotalSubmissions:

49942

Accepted:

19535

Description

Onemeasureof``unsortedness''inasequenceisthenumberofpairsofentriesthatareoutoforderwithrespecttoeachother.Forinstance,inthelettersequence``DAABEC'',thismeasureis5,sinceDisgreaterthanfourletterstoitsrightandEisgreaterthanonelettertoitsright.Thismeasureiscalledthenumberofinversionsinthesequence.Thesequence``AACEDGG''hasonlyoneinversion(EandD)---itisnearlysorted---whilethesequence``ZWQM''has6inversions(itisasunsortedascanbe---exactlythereverseofsorted).

YouareresponsibleforcataloguingasequenceofDNAstrings(sequencescontainingonlythefourlettersA,C,G,andT).However,youwanttocatalogthem,notinalphabeticalorder,butratherinorderof``sortedness'',from``mostsorted''to``leastsorted''.Allthestringsareofthesamelength.

Input

Thefirstlinecontainstwointegers:

apositiveintegern(0

Output

Outputthelistofinputstrings,arrangedfrom``mostsorted''to``leastsorted''.Sincetwostringscanbeequallysorted,thenoutputthemaccordingtotheorginalorder.

SampleInput

106

AACATGAAGG

TTTTGGCCAA

TTTGGCCAAA

GATCAGATTT

CCCGGGGGGA

ATCGATGCAT

SampleOutput

CCCGGGGGGA

AACATGAAGG

GATCAGATTT

ATCGATGCAT

TTTTGGCCAA

TTTGGCCAAA

玛雅历

TimeLimit:

1000MS

MemoryLimit:

10000K

TotalSubmissions:

41850

Accepted:

12759

Description

上周末,M.A.Ya教授对古老的玛雅有了一个重大发现。

从一个古老的节绳(玛雅人用于记事的工具)中,教授发现玛雅人使用了一个一年有365天的叫做Haab的历法。

这个Haab历法拥有19个月,在开始的18个月,一个月有20天,月份的名字分别是pop,no,zip,zotz,tzec,xul,yoxkin,mol,chen,yax,zac,ceh,mac,kankin,muan,pax,koyab,cumhu。

这些月份中的日期用0到19表示。

Haab历的最后一个月叫做uayet,它只有5天,用0到4

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

当前位置:首页 > IT计算机 > 电脑基础知识

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

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