ACM杯比赛往年试题集锦.docx
- 文档编号:11976840
- 上传时间:2023-04-16
- 格式:DOCX
- 页数:18
- 大小:71.46KB
ACM杯比赛往年试题集锦.docx
《ACM杯比赛往年试题集锦.docx》由会员分享,可在线阅读,更多相关《ACM杯比赛往年试题集锦.docx(18页珍藏版)》请在冰豆网上搜索。
ACM杯比赛往年试题集锦
ConstructingRoads
TimeLimit:
2000MS
MemoryLimit:
65536K
TotalSubmissions:
12262
Accepted:
4862
Description
ThereareNvillages,whicharenumberedfrom1toN,andyoushouldbuildsomeroadssuchthateverytwovillagescanconnecttoeachother.WesaytwovillageAandBareconnected,ifandonlyifthereisaroadbetweenAandB,orthereexistsavillageCsuchthatthereisaroadbetweenAandC,andCandBareconnected.
Weknowthattherearealreadysomeroadsbetweensomevillagesandyourjobisthebuildsomeroadssuchthatallthevillagesareconnectandthelengthofalltheroadsbuiltisminimum.
Input
ThefirstlineisanintegerN(3<=N<=100),whichisthenumberofvillages.ThencomeNlines,thei-thofwhichcontainsNintegers,andthej-thoftheseNintegersisthedistance(thedistanceshouldbeanintegerwithin[1,1000])betweenvillageiandvillagej.
ThenthereisanintegerQ(0<=Q<=N*(N+1)/2).ThencomeQlines,eachlinecontainstwointegersaandb(1<=a
Output
Youshouldoutputalinecontainsaninteger,whichisthelengthofalltheroadstobebuiltsuchthatallthevillagesareconnected,andthisvalueisminimum.
SampleInput
3
0990692
9900179
6921790
1
12
SampleOutput
179
Source
PKUMonthly,kicc
TheWolvesandtheSheep
TimeLimit:
15000MS
MemoryLimit:
131072K
TotalSubmissions:
332
Accepted:
77
Description
Nalim,OcisandRemmargutsareplayingongrass,andtheyfeelveryhungrynow.Asbabywolves,theydecidetocapturealittlesheeptoeat.Fortunately,theyimmediatelydiscoverasheeproamingaroundthegrass.However,whattheyfoundisthequeenofthesheep----Mmxl,whohasextraordinaryspeedthatcancomparewiththewolves,andisveryclever!
CanyoujudgewhetherthebabywolveswillcaptureMmxl!
Therearesomerulestofollow:
ThegrassfieldisarectangularareathatconsistofR*Cgrids.Andsomeobstacleslikestonesortreesexist.TheactionsofthebabywolvesandMmxlaretakeninrounds.Ineachround,babywolvestakeactionsfirst,andthenMmxlfollows.Inthebabywolves'turn,thethreewolveswillmakeadecision,andchooseoneofthemtomove(amovemeansmovingfromagridtoaneighboringgrid).Theremustbeawolftomove,unlessnoneofthemcanmove.IntheMmxl'sturn,shewillalwaysmove.Ifshecannotmove,sheiscaptured.BabywolvesandMmxlcannotmovetothegridsonwhichthereareobstacles,andtheyarealwaysondifferentgrids.Babywolveswillnevergetoutoftherectangulararea.OnceMmxlgetsawayfromthegrass,sheisnevercaptured.
YoushouldnoticethattheonlysituationthatMmxliscapturedisthatshecannotmove,butisnotthatinwolves'turn,somewolfisintheneighboringgridofMmxl's.
Input
Inputcontainsmultipletestcases.EachtestcasestartswithtwonumbersRandC(1<=R,C<=10)inoneline.ThenRlinesfollow,eachlinehasCcharacters,whichdescribesthegrassfield.A'.'denotesanemptygrid,an'X'denotesanobstacle,a'W'denotesababywolf,anda'S'denotestheMmxl.Thereareexactlythree'W'andone'S'.Everytestcasewillbefollowedbyablankline.
Output
Thereisonlyonelineforeachtestcase.IflovelyMmxlwillnotbecapturedinfinityrounds,print"LuckyMmxlissafe:
)".IfthewickedbabywolvesareabletocaptureMmxl,print"PoorMmxlisindanger:
(".
SampleInput
35
XXW.X
XWSWX
XXX.X
45
XXWXX
XWSWX
XX.XX
XX.XX
76
XXXXXX
XWWW.X
X....X
X....X
X....X
X...SX
XXXXXX
77
XXXXXXX
XWWW..X
X.....X
X..X..X
X.....X
X....SX
XXXXXXX
77
XXXXXXX
XWWW..X
X.....X
X..XX.X
X.....X
X....SX
XXXXXXX
1010
WWW.......
..........
..........
..........
..........
.....S....
..........
..........
..........
..........
99
XXXXXXXXX
X...X...X
XW.....WX
X.X...X.X
X..X.X..X
X...S...X
XXXXXXXXX
XWXXXXXXX
XXXXXXXXX
99
XXXXXXXXX
X.......X
XW.....WX
X.X...X.X
X..X.X..X
X...S...X
XXXXXXXXX
XWXXXXXXX
XXXXXXXXX
99
XXXXXXXXX
....X....
XW.....WX
X.X...X.X
X..X.X..X
X...S...X
XXXXXXXXX
XWXXXXXXX
XXXXXXXXX
33
WX.
XSX
WXW
SampleOutput
LuckyMmxlissafe:
)
LuckyMmxlissafe:
)
PoorMmxlisindanger:
(
LuckyMmxlissafe:
)
PoorMmxlisindanger:
(
LuckyMmxlissafe:
)
PoorMmxlisindanger:
(
LuckyMmxlissafe:
)
LuckyMmxlissafe:
)
PoorMmxlisindanger:
(
Source
PKUMonthly,CHENShixi(xreborner)
[Submit] [GoBack] [Status] [Discuss]
HomePage
GoBack
Totop
TheParallelChallengeBallgame
TimeLimit:
1000MS
MemoryLimit:
65536K
TotalSubmissions:
123
Accepted:
31
Description
BeforetheACM/ICPCworldfinal2005,thereisacompetitioncalled"TheParallelChallengeBallgame".TheParallelChallengeballgamegiveseachteamachancetopittheirprogrammingskillsagainstthoseofotherteamsinafast-movingparallel-programminggameofskill,treachery,andhazardavoidance.EachteamwillwriteasingleC++classnamedMyPlayerwhichdefinesthecharacteristicsofa"player".TheMyPlayerclasswillbeinstantiatedfivetimesintheenvironment,makingupafive-playerteam,whichwillthencompeteinaseriesofParallelChallengeballgamesrunningonanIBMPowerArchitectureBlueGenesupercomputer–theworld’sfastestcomputer.
AParallelChallengeballgameisplayedonarectangularfiled.Thefiledissurroundedbyawall;ballswillbounceoffthewallsiftheyrunintoit.Theruleofbouncingisthesameaslight(Infigure1,angle1equalsangle2).Neartheedgesofthefieldsareanumberofgoalswherepointscanbescored.Goalsarerectangularareaslyingneartheedgesofthefieldbutwithinthefieldboundaries.Whenthegamestartsthereareanumberofballsplacedatrandomlocationsonthefield.Aplayercanmovetoaball,pickitup,andthrow(ofcourse,itisnotfootball,whynotusehand?
)it.Atthestartofeachgametherearealsoanumberof"nets"distributedatvariouslocationsontheedgesofthefield.Aplayercanmovetoandpickuponeofthesenets,andcanthenusethemto"trap"playersonotherteamsbythrowingthenetontopofthem.Onceaplayeristrappedbeneathanet,thatplayercannotdoanythingmoreinthegameuntilateammatecomesandliftsthenetfromthetrappedplayer.Aplayermay"tackle"anotherplayer,normallyinanattempttodislodgeaballbeingcarriedbytheotherplayer(althoughitisalsolegaltotackleaplayerwhoisnotcarryingaball).
TheobjectiveofeachteamistowritetheirMyPlayerclasssothattheirplayers(thefiveinstancesoftheclass)operateinacoordinatedfashion,takingadvantageofthevariouswaystoscorepointswhileatthesametimeavoidingbothhazardsonthegamefiledandimpedimentsthrownatthembyplayersfromotherteams.Thewinnerofagameistheteamwhoseplayersscorethelargesttotalnumberofpoints.
Therearemanywaystoscorepoints:
(1)SuccessfulTackle(tacklenotcaughtbyReferees)
(2)Opponent’sFailedTackle
(3)Throwinganetononeormoreopponents
(4)Liftinganetoffateammate
Andofcourse,thenormalapproach:
(5)Carryorthrowtheballsintogoals.Thisisalsotheeasiestwaytoscorepoints.Inordertogetmorechancetomakeaballintothegoal,itisbettertothrowaballtoagoalonceyougetit.Theballmaybeblockedbyotherplayer,buttheprobabilityislow,becauseathrownballmovesatthemaximumspeedallowedinthegame,andtheplayercannotcatchupwithit.Sotheonlywayitisblockedisthatsomeplayerisjustonthedirection,whichtheballmoves.Andbecausetheballwillbounceoffthewallwhenithitsthewall,itisnotnecessarytothrowaballstraighttoagoal(seefigure2).Butthemoretimestheballbouncesoffthewall,thehigherprobabilitythatotherplayerwillheadoffit.Soweonlyconsidertheballbouncesoffthewallnomorethanonce.
Hereisourproblem.Giventherangeofthefield,thepositionoftheballandthegoals,thesizeofthegoals,yourtaskistocalculatehowmanypercentsofthedirectionthattheteamcanscorepointsthroughmethod(5).
Input
Inthefirstlineofinput,thereisanintegert,whichisthenumberoftestcasesandfollowedbythedataforthetestcases.Thefirstlineofeachtestcasecontainsfourintegers:
x1,y1,x2,y2,and(x1,y1)and(x2,y2)(-1000<=x1,y1,x2,y2<=1000)arethecoordinatesofthediagonallypointsofthefield.Inthenextline,therearetwointegersxandy,and(x,y)isthecoordinateoftheball.Thethirdlineofeachtestcasecontainsanintegern(0<=n<=100),whichisthenumberofthegoals.Innextnlines,eachlinecontainsfourintegers:
xi1,yi1,xi2,yi2,and(xi1,yi1)and(xi2,yi2)arethecoordinatesofthediagonallypointsofthei-thgoal.Youmayassumethegoalsandtheballareinsidethefield.Andifaballmoveintoorontheboundariesofagoal,theteamscorespoints.
Output
Theoutputcontainsonelinepertestcasecontaininganumber,whichisdescribedaboveandfolloweda"%".Thenumbershouldberoundeduptotwodecimaldigits.SeetheSampleOutputtoknowtheexactformat.
SampleInput
1
100100-100-100
00
1
1010-1020
SampleOutput
28.34%
Source
PKUMonthly,daofeng
[Submit] [GoBack] [Status] [Discuss]
HomePage
GoBack
Totop
AllRightsReserved2003-2007YingFuchen,XuPengcheng,XieDi
Any
Flo'sRestaurant
TimeLimit:
1000MS
MemoryLimit:
65536K
TotalSubmissions:
1911
Accepted:
539
Description
Sickandtiredofpushingpaperinthedrearybleary-eyedworldoffinance,Floditchedherdeskjobandbuiltherown
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- ACM 比赛 往年 试题 集锦