ACM杯比赛往年试题集锦.docx

上传人:b****3 文档编号:2838154 上传时间:2022-11-15 格式:DOCX 页数:18 大小:139.62KB
下载 相关 举报
ACM杯比赛往年试题集锦.docx_第1页
第1页 / 共18页
ACM杯比赛往年试题集锦.docx_第2页
第2页 / 共18页
ACM杯比赛往年试题集锦.docx_第3页
第3页 / 共18页
ACM杯比赛往年试题集锦.docx_第4页
第4页 / 共18页
ACM杯比赛往年试题集锦.docx_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

ACM杯比赛往年试题集锦.docx

《ACM杯比赛往年试题集锦.docx》由会员分享,可在线阅读,更多相关《ACM杯比赛往年试题集锦.docx(18页珍藏版)》请在冰豆网上搜索。

ACM杯比赛往年试题集锦.docx

ACM杯比赛往年试题集锦

EscortofDr.WhoHow

TimeLimit:

2000MS

MemoryLimit:

131072K

TotalSubmissions:

1376

Accepted:

266

Description

Thenotoriousringleaderandcyber-criminalDerekWu,betterknownasDr.WhoHow,hasbeenconvictedformultipleabductionsandcyber-fraudsseveralminutesago.Hewillsoonbetransferredfromthecourttotheprisontoservealifesentence.IntelligencefromundercoverofficersinDr.WhoHow’soutlawedgangindicatesapossibleforciblerescueoperationbygangmembersinthecasethatDr.WhoHowisconvicted.Toensureasuccessfulescort,besidesadoptingenhancedsecuritymeasures,thepoliceforcefurtherdesirestominimizetheescorttime—thetimethatthemotorcadeofescorthastospendbetweendeparturefromthecourtandarrivalattheprison.

Thecomplextrafficconditioninthecityimposescomplicationsonthepoliceforce’sescorteffort.Whilethemunicipalgovernmenthasagreedtotemporarilyshutdownafewroadsforexclusivepoliceuse,theshut-downtimewindowsvaryamongroadsandaregenerallynarrowtoavoidexcessivelydisturbingthelifeofthecitizens.Themotorcadeofescortmustpassthroughanyroadentirelywithinitsshut-downtimewindowandnotuseanyroadthatthemunicipalgovernmenthasnotagreedtoshutdown.

Giveninformationaboutallroadsavailabletothepoliceforcefortheescort,determinetheshortestescorttime.

Input

Theinputcontainsasingletestcase.Thefirstlinecontainsfourintegersn,m,sandt(2≤n≤100;0≤m≤1000;1≤s,t≤n;s≠t).Therearenjunctions,somepairsofwhichareconnectedbymroads.Thecourtandtheprisonarelocatedatthes-thandthet-thjunctions,respectively.Thenextmlineseachcontainfiveintegersx,y,b,eandc(1≤x,y≤n;0≤b

Output

Iftheescortispossible,printtheshortestescorttime;otherwise,print“Impossible”.

SampleInput

4514

12011

12012

13132

24341

34341

SampleOutput

3

Hint

ThesampleisdepictedinFigure1.Eachjunctionisrepresentedbyanumberedspot.Eachroadisrepresentedbyanarrowlabeledwith

itsshut-downtimewindowandpass-throughtime.

Figure1:

Depictionofthesample

Thesecondroadlistedinthesampleisvirtuallyunusableforittakesthemotorcadeofescortlongertimetopassthroughthanitcanstayavailable.Theremainingfourroadsenablethefollowingtwoescortroutes:

1.

2.

(Thelabel

overanarrowindicatesthatthemotorcadepassesthroughthecorrespondingroadbetweentimesandt.)Thefirstroutetakesfourunitsofescorttime,whereasthesecondtakesthree,whichistheshortestpossible.

Source

PKUCampus2008(POJFounderMonthlyContest–2008.05.10),frkstyc

FullSteinerTopologies

TimeLimit:

1000MS

MemoryLimit:

131072K

TotalSubmissions:

441

Accepted:

187

SpecialJudge

Description

AfullSteinertopologyforagivenpointsetP={p1,p2,…,pn}isanundirectedtreeT=(V,E)whereV={v1,v2,…,vn,vn+1,…,v2n−2}isthesetofvertices,andEisthesetofedges.ThendistinctlylabeledleavesofT,v1,v2,…,vn,correspondtop1,p2,…,pn,respectively;theremainingn−2vertices,vn+1,vn+2,…,v2n−2,calledtheSteinervertices,aremutuallyindistinguishableandeachhaveadegreeofthree.Figure2showstheonlyfullSteinertopologyforP={p1,p2,p3}.Figure3showsallthreedifferentfullSteinertopologiesforP={p1,p2,p3,p4}.

Figure2:

FullSteinertopologyforP={p1,p2,p3}

Figure3:

FullSteinertopologiesforP={p1,p2,p3,p4}

Givenn,thecardinalityofP,computethenumberofdistinctfullSteinertopologies.

Input

Theinputcontainsmultipletestcases.Eachtestcaseconsistsofasingleintegern(3≤n≤107)onaseparateline.TheinputendswhereEOFismet.

Output

Foreachtestcase,printtheansweronaseparateline.Youshallprinttheanswerroundedtofoursignificantdigits.Letm·10ebethescientificformoftheroundedanswer,youshallprint“mEe”,givingallfoursignificantdigitsofmandstrippinganyleadingzeroesbeforee.

SampleInput

3

30

300

3000

30000

300000

3000000

SampleOutput

1.000E0

8.687E36

5.677E697

1.462E10024

1.983E130306

4.215E1603145

7.937E19031556

Source

PKUCampus2008(POJFounderMonthlyContest–2008.05.10),frkstyc

IlluminatedPlanet

TimeLimit:

1000MS

MemoryLimit:

131072K

TotalSubmissions:

198

Accepted:

45

Description

Aspaceprobeisonamissiontoobserveaplanetarysystem.Itisinstructedtoshootimagesofaplanet,whichorbitsastar,usingitso

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

当前位置:首页 > 自然科学 > 天文地理

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1