GDCC程序设计大赛决赛试题.docx
- 文档编号:9137944
- 上传时间:2023-02-03
- 格式:DOCX
- 页数:14
- 大小:25.49KB
GDCC程序设计大赛决赛试题.docx
《GDCC程序设计大赛决赛试题.docx》由会员分享,可在线阅读,更多相关《GDCC程序设计大赛决赛试题.docx(14页珍藏版)》请在冰豆网上搜索。
GDCC程序设计大赛决赛试题
ProblemA
(InputFile:
input.txt/StandardOutput)
Description
HaveyoueverplayedMinesweeper?
It'sacutelittlegamewhichcomeswithinacertainOperatingSystemwhichnamewecan'treallyremember.Well,thegoalofthegameistofindwhereareallthemineswithinaMxNfield.Tohelpyou,thegameshowsanumberinasquarewhichtellsyouhowmanyminesthereareadjacenttothatsquare.Forinstance,suposethefollowing4x4fieldwith2mines(whicharerepresentedbyan*character):
44
*...
....
.*..
....
Ifwewouldrepresentthesamefieldplacingthehintnumbersdescribedabove,wewouldendupwith:
*100
2210
1*10
1110
Asyoumayhavealreadynoticed,eachsquaremayhaveatmost8adjacentsquares.
Input
Theinputwillconsistofanarbitrarynumberoffields.Thefirstlineofeachfieldcontainstwointegersnandm(0 Output Foreachfield,youmustprintthefollowingmessageinalinealone: Field#x: Where“x“standsforthenumberofthefield(startingfrom1).Thenextnlinesshouldcontainthefieldwiththe"."charactersreplacedbythenumberofadjacentminestothatsquare.Theremustbeanemptylinebetweenfieldoutputs. SampleInput 44 *... .... .*.. .... 35 **... ..... .*... 00 SampleOutput Field#1: *100 2210 1*10 1110 Field#2: **100 33200 1*100 ProblemB (InputFile: input.txt/StandardOutput) Description ThereisaqueuewithNpeople.Everypersonhasadifferentheigth.WecanseePpeople,whenwearelookingfromthebeginningandRpeople,whenwearelookingfromtheend.It’sbecausetheyarehavingdifferentheightandtheyarecoveringeachother.Howmanydifferentpermutationsofourqueuehassuchainterestingfeature? Input TheinputconsistsofTtestcases.Thenumberofthem(1<=T<=10000)isgivenonthefirstlineoftheinputfile. Eachtestcaseconsistsofalinecontainingthreeintegernumbers: Nthatindicatesthenumberofpeopleinaqueue(1<=N<=13),andthentwomoreintegers.Thefirstcorrespondstothenumberofpeople,thatwecanseelookingfromthebeginning,andthesecondcorrespondingtothenumberofpeople,thatwecanseelookingfromtheend. Output Foreverytestcaseyourprogramhastodetermineoneinteger.PrinthowmanypermutationsofNpeoplewecanseeexactlyPpeoplefromthebeginning,andRpeople,whenwearelookingfromtheend. SampleInput 3 1044 1131 312 SampleOutput 90720 1026576 1 ProblemC (InputFile: input.txt/StandardOutput) Description In1976the``FourColorMapTheorem"wasprovenwiththeassistanceofacomputer.Thistheoremstatesthateverymapcanbecoloredusingonlyfourcolors,insuchawaythatnoregioniscoloredusingthesamecolorasaneighborregion. Hereyouareaskedtosolveasimplersimilarproblem.Youhavetodecidewhetheragivenarbitraryconnectedgraphcanbediscolored.Thatis,ifonecanassigncolors(fromapaletteoftwo)tothenodesinsuchawaythatnotwoadjacentnodeshavethesamecolor.Tosimplifytheproblemyoucanassume: Nonodewillhaveanedgetoitself. Thegraphisnodirected.Thatis,ifanodeissaidtobeconnectedtoanodeb,thenyoumustassumethatbisconnectedtoa. Thegraphwillbestronglyconnected.Thatis,therewillbeatleastonepathfromanynodetoanyothernode. Input Theinputconsistsofseveraltestcases.Eachtestcasestartswithalinecontainingthenumbern(1 Output Youhavetodecidewhethertheinputgraphcanbediscoloredornot,andprintitasshownbelow. SampleInput 3 3 01 12 20 9 8 01 02 03 04 05 06 07 08 0 SampleOutput NOTBICOLORABLE. BICOLORABLE. ProblemD (InputFile: input.txt/StandardOutput) Description JinYueTuanisafamousonlinegamewhichhasbeeninvogueforalongtime.Chjingplaysitveryoftenyearsago.Ipromiseyouwouldlikeittoo.NowIwanttointroduceittoyou.Maybeyouhavealreadyknownitclearly.Justbepatient. JinYueTuanisafamousonlinegamewhichhasbeeninvogueforalongtime.Sinceitissoexcitingagamethatalargenumberofplayersputthemselvesinit.Onlysevenkeysonthekeyboardwillbeusedingames,eachkeyareassignedtooneofthesevensoundtracks.Duringthegame,aseriesofnotesmayfallineachsoundtrackirregularly.Whennotesfalldowninonesoundtrack,playershouldpresstheassignedkeyatonce.Ifso,thengota“Cool”,orget“Miss”otherwise.Youshouldpressthekeywhenthenoteisalmostdisappearedatthebottomofthewindow.Ifyoupressthekeytooearly,youwillmissthenote.Therewillbeasongorsomekindofmusicplayedwhenyouareplayingthegame.Soyouwillfeelyouareapianist.Asyoupassalowlevel.thenoteswillbemoreandthespeedthenotesfallwillbeveryhigh.Andthegamewillbemoreexciting.Therearealotofcowswhoplaythisgameverywell.Ifyouhaveachancetowatchthemplaying,youwouldsay‘orz’fromyourheart.Butasaprogrammer,wewouldadmirepeoplewhowritethisgamemore.Herecomestheproblem. Ifyouareassignedwriteagamesimilartothisgame.Ifthereare‘n’differentsoundtracksand‘m’differentnotes.Howmanydifferentwayscanyouarrangethenotestofall? Input Therearemultipletestcase,eachcasecontainsalineofthreenumbersn,m,p.(0 Output Outputtheresultmodp. SampleInput 221000 SampleOutput 6 ProblemE (InputFile: input.txt/StandardOutput) Description InChina,peopleuseapairofchopstickstogetfoodonthetable,butMr.Lisabitdifferent.Heusesasetofthreechopsticks--onepair,plusanextralongchopsticktogetsomebigfoodbypiercingitthroughthefood.Asyoumayguess,thelengthofthetwoshorterchopsticksshouldbeascloseaspossible,butthelengthoftheextraoneisnotimportant,aslongasit'sthelongest.Tomakethingsclearer,forthesetofchopstickswithlengthsA,B,C(A<=B<=C), iscalledthe'badness'oftheset. It'sDecember2nd,Mr.L'sbirthday! HeinvitedKpeopletojoinhisbirthdayparty,andwouldliketointroducehiswayofusingchopsticks.So,heshouldprepareK+8setsofchopsticks(forhimself,hiswife,hislittleson,littledaughter,hismother,father,mother-in-law,father-in-law,andKotherguests).ButMr.Lsuddenlydiscoveredthathischopsticksareofquitedifferentlengths! HeshouldfindawayofcomposingtheK+8sets,sothatthetotalbadnessofallthesetsisminimized. Input ThefirstlineintheinputcontainsasingleintegerT,indicatingthenumberoftestcases(1<=T<=20).EachtestcasebeginswithtwointegersK,N(0<=K<=1000,3K+24<=N<=5000),thenumberofguestsandthenumberofchopsticks.ThereareNpositiveintegersLionthenextlineinnon-decreasingorderindicatingthelengthsofthechopsticks.(1<=Li<=32000). Output Foreachtestcaseintheinput,printalinecontainingtheminimaltotalbadnessofallthesets. SampleInput 1 140 1810161922273336404752566163717275818184889698103110113118124128129134134139148157157160162164 SampleOutput 23 ProblemF (InputFile: input.txt/StandardOutput) Description InanepisodeoftheDickVanDykeshow,littleRichieconnectsthefrecklesonhisDad'sbacktoformapictureoftheLibertyBell.Alas,oneofthefrecklesturnsouttobeascar,sohisRipley'sengagementfallsthrough. ConsiderDick'sbacktobeaplanewithfrecklesatvarious(x,y)locations.YourjobistotellRichiehowtoconnectthedotssoastominimizetheamountofinkused.Richieconnectsthedotsbydrawingstraightlinesbetweenpairs,possiblyliftingthepenbetweenlines.WhenRichieisdonetheremustbeasequenceofconnectedlinesfromanyfreckletoanyotherfreckle. Input Theinputbeginswithasinglepositiveintegeronalinebyitselfindicatingthenumberofthecasesfollowing,eachofthemasdescribedbelow.Thislineisfollowedbyablankline,andthereisalsoablanklinebetweentwoconsecutiveinputs. Thefirstlinecontains0 Output Foreachtestcase,theoutputmustfollowthedescriptionbelow.Theoutputsoftwoconsecutivecaseswillbeseparatedbyablankline. Yourprogramprintsasinglerealnumbertotwodecimalplaces: theminimumtotallengthofinklinesthatcanconnectallthefreckles. SampleInput 1 3 1.01.0 2.02.0 2.04.0 SampleOutput 3.41 ProblemG (InputFile: input.txt/StandardOutput) Description Theworld-knowngangsterVitoDeadstoneismovingtoNewYork.Hehasaverybigfamilythere,allofthemlivinginLamafiaAvenue.Sincehewillvisitallhisrelativesveryoften,heistryingtofindahouseclosetothem.Vitowantstominimizethetotaldistancetoallofthemandhasblackmailedyoutowrite
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- GDCC 程序设计 大赛 决赛 试题