湖南大学ACMWord文档下载推荐.docx
- 文档编号:21289739
- 上传时间:2023-01-29
- 格式:DOCX
- 页数:21
- 大小:89.71KB
湖南大学ACMWord文档下载推荐.docx
《湖南大学ACMWord文档下载推荐.docx》由会员分享,可在线阅读,更多相关《湖南大学ACMWord文档下载推荐.docx(21页珍藏版)》请在冰豆网上搜索。
G题Oulipo:
典型的KMP,alpc117大敲一顿过了.
H题LuckyLight:
这道题我没有过问,这是我们上场敲的第一题,ALPC02A了它,不过罚时较多.好在AC之后我们队越来越顺
I题Sightseeing:
首先是求最短路,然后分别对最短路和最短路+1做记忆化搜索.
ProblemA:
Cheesy
Chess
TimeLimit:
5000ms,SpecialTimeLimit:
12500ms,MemoryLimit:
65536KB
Totalsubmitusers:
4,Acceptedusers:
1
Problem11011:
Nospecialjudgement
Problemdescription
ChessyChessisasimpletwo-persongame.Itisplayedonan8x8board.Eachplayerhasonepiece.Theplayerstaketurnsinmovingtheirrespectivepieces.
Thefirstplayer,sayWhite,hasaking.Inonemove,itcanmoveonepositioninanyoftheeightdirections,horizontally,verticallyordiagonally,aslongasitstaysontheboard.Thesecondplayer,sayBlack,hasapawn.Inonemove,itcanmoveexactlyonepositiondownwards.Infact,thepieceshavetomakesuchmoves.Themaynotstayattheirpositions.
TheWhitekingissaidtocapturetheBlackpawn,iftimovesontothepositioncurrentlyoccuiedbythepawn.TheaimoftheWhitekingistodoexactlythis.TheaimoftheBlackpawnistoreachthebottomlineoftheboardsafely.Aswewillseelater,however,thesearealsootherwaysforWhiteandBlacktowin.
Thegameiscomplicatedbythepresenceofforbiddenfieldsanddangerousfields.AforbiddenfieldisapositionwhereneithertheWhiteking,northeBlackpawnmaycome.AdangerousfieldisapositionwheretheBlackpawnmaycome,butwheretheWhitekingmaynotmoveonto.
Inadditiontothefixeddangerousfields,whicharedangerousfortheentiregame,theseare(atmost)twoother,floatingdangerousfields,whichdependonthepositionoftheBlackpawn.Theareadjacenttothepawn’sposition:
thepositiontothebottomleftandbottomrightofthepawn,forasforasthesepositionsexitwithintheboundariesoftheboardandarenotforbidden.
Allotherpositionsarecalledopenfields,eveniftheyareoccupiedbyeitherofthepieces.
Forexample,wemayhavethefollowingsituation,whereforbiddenfields,dangerousfieldsandopenfieldsaredenotedby‘F’,‘D’and‘.’,respectively,theWhitekingisdenotedby‘K’andtheBlackpawnisdenotedby‘F’.
ThisillustrationdoesnotrevealwhetherthepositionsoccupiedbytheWhiteandtheBlackpawnaredangerousoropen,andwhetherthedangrousfieldsadjacenttothepositionofthepawnarefixeddangerousfieldsornot.
DuetoamoveoftheBlackpawn,theWhiteking’spositionmaybecomedangerous.Thisisnotaproblem:
inthenextmove,theWhitekinghastomovetoanother,openfieldanyway.TheWhitekingblockstheBlackpawn,ifBlackistomove,butthepositionbelowthepawnisoccupiedbytheWhiteking.Inthiscase,thepawncannotmove.
Thegameends,when
.theWhitekingcapturestheBlackpawn;
inthiscase,Whitewins;
.theWhitekingistomove,butcannotmovetoanopenfield;
inthiscase,Blackwins;
.theBlackpawnistomove,butcannotmovetoanopenfieldoradangerousfield;
ifthepawnisatthebottomlineoftheboard,thenBlackwins,otherwiseWhitewins.
Youhavetofindoutwhichplayerwillwin,giventhatWhiteisthefirstpalyertomoveandgiventhatWhiteplaysoptimally.
Input
Thefirstlineofinputfilecontainsasinglenumber:
thenumberoftestcasestofollow.Eachtestcasehasthefollowingformat:
.Adescriptionoftheboard,consistingof8lines,corresondingtothe8linesoftheboard,fromtoptobottom.Eachlinecontainsastringof8charactersfrom{‘F’,‘D’,‘.’}.Here‘F’denotesaforbiddenfield,‘D’denotesafixeddangerousfieldand‘.’(aperiod)denotesanopenfied.
Ofcouse,anopenfieldmaybecomedangerousduetothepositionoftheBlackpawn.
.Onelinewithtwointegersxkandyk(1<
=xk,yk<
=8),separatedbyasinglespace,specifyingtheinitialpositionoftheWhiteking.Here,xkdenotesthecolumn(countedfromleft)andykdenotestherow(countedfrombelow).
.Onelinewithtwointegersxpandyp(1<
=xp,yp<
=8),separatedbyasinglespace,specifyingtheinitialpositionoftheBlackpawn.Here,xpdenotesthecolumn(countedfromleft)andykdenotestherow(countedfrombelow).
Thisinitialpositionisnotaforbiddenfield,andisdifferentfromtheinitialpositionoftheWhiteking.
Output
Foreverytestcaseintheinputfile,theoutputshouldcontainasinglelinecontainingthestring“White”(ifWhitewins)or“Black”(ifBlackwins).
Example
Thefirsttestcasebelowcorrespondstothepicturesintheproblemdescription.
SampleInput
2
........
.......D
.....F.
..DDD...
..DFDD..
76
37
31
63
SampleOutput
Black
White
JudgeTips
AnysimilarityofthisproblemtothegameChessiscompletelycoincidental.
ProblemB:
Frobenius
30,Acceptedusers:
29
Problem11012:
TheFrobeniusproblemisanoldprobleminmathematics,namedaftertheGermanmathematicianG.frobenius(1849-1917).
Leta1,a2,...,anbeintegerslagerthan1,withgreatestcommondivisor(gcd)1.Thenitisknownthattherearefinitelymanyintegerslargerthanorequalto0,thatcannotbeexpressedasalinearcombinationw1a1+w2a2+...+wnanusingintegercoefficientswi>
=0.ThelargestofsuchnonnegativeintegersisknownastheFrobeniusnumberofa1,a2,...,an(denotedbyF(a1,a2,...,an)).So:
F(a1,a2,...,an)isthelargestnonnegativeintegerthatcannonbeexpressedasnonnegativelinearcombinationofa1,a2,...,an.
Forn=2thereisasimpleformulaforF(a1,a2).However,forn>
=3itismuchmorecomplicated.Forn=3onlyforsomespecialchoicesofa1,a2,a3formulasexist.Forn>
=4noformulasareknownatall.
WewillconsiderheretheFrobeniusproblemforn=4.Inthiscaseourversionoftheproblemcanbeformulatedasfollows.Letfourintegersa,b,c,anddbegiven,witha,b,c,d>
1andgcd(a,b,c,d)=1.wewanttoknowtwothings.
Howmanynonnegativeintegerslessthanorequal1,000,000cannotbeexpressedasanonnegativeintegerlinearcombinationofthevaluesa,b,c,andd?
IstheFrobeniusnumberofa,b,c,anddlessthanorequalto1,000,000andifso,whatisitsvalue?
Thefirstlineoftheinputfilecontainsasinglenumber:
thenumberoftestcaseshasthefollowingformat:
Oneline,containingfourintegersa,b,c,d(with1<
a,b,c,d<
=10,000andgcd(a,b,c,d)=1),separatedbysinglespaces.
Foreverytestcaseintheinputfile,theoutputshouldcontainteolines.
Thefirstlinecontainsthenumberofintegersbetween0and1,000,000(boundariesincluded)thatcannotbeexpressedasa*w+b*x+c*y+d*z,wherew,x,y,zarenonnegative(meaning>
=0)integers.
ThesecondlinecontainstheFrobeniusnumberifthisislessorequalto1,000,000andotherwise-1,meaningthattheFrobeniusbunberofa,b,canddislargerthan1,000,000.
3
8597
5855
1938193919401937
6
11
14
27
600366
-1
ProblemC:
Mineshaft
0,Acceptedusers:
0
Problem11013:
Aplumberhasbeenhiredtobuildanairpipethroughamineshaftfromthebottomtothesurface.Themineshaftwasbuiltwithoutmoderntechnology,soitwindsitswayupthroughtheearth.Becauseitisverytimeconsumingtobringthetoolsnecessarytobendthepipebelowthesurface.theplumberwantstominimizethenumberofbendsinthepipeline.
Forexample,forthemineshaftinthefirstpicturebelow,theminimalnumberofbendsinapipelinefromthebottomtothesurfaceistwo.Differentoptimalsolutionsexist,oneofwhichisshowninthesecondpicture.Thebulletsindicatethebendsinthepipeline.
Thetwowallsofthemineshaftareformedbysequencesofstraightsegments.Thenumbersofsegmentsinthetwosequencesmaybedifferent.Further,thehorizontaldistancebetweenthewallsofthemineshaftmayvary,butisalwayspositive.Bothwallsstartatthesamelevelandendatthesamelevel.
Onthewayformthebottomofthemineshafttothesurface,thelevel(they-coordinate)increaseswitheverysegmentofawall.Hence,themineshaftdoesnothavehorizontalplateausor'
ceilings'
andatnopointdoesitgobackdownagain.
Forthepurposeofthistask.youmayassumethediameterofthepipelinetobe0.Atnopointmaythepipelinecrossthewalls.Inordertoattachthepipelinefirmlytothewall,eachsegmentofthepipelinehastotouchthewallsat(atleast)twodifferentplaces.Howeverm,thebendingpointsofthepipelineareweak.Theycannotbeusedtoattachthepipelinetothewallls.Theendpointsofthepipeline,tough,atthebottomandthetopofthemineshaft,maybeusedtoattachasegmenttothewalls.
Hence,thesolutioninthethirdpictureabove(alsohavingtwobends)isnotallowed,becausethelowestsegmentofthepipelinecanbeattachedto
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 湖南大学 ACM
![提示](https://static.bdocx.com/images/bang_tan.gif)