GDCC程序设计大赛决赛试题.docx

上传人:b****7 文档编号:9137944 上传时间:2023-02-03 格式:DOCX 页数:14 大小:25.49KB
下载 相关 举报
GDCC程序设计大赛决赛试题.docx_第1页
第1页 / 共14页
GDCC程序设计大赛决赛试题.docx_第2页
第2页 / 共14页
GDCC程序设计大赛决赛试题.docx_第3页
第3页 / 共14页
GDCC程序设计大赛决赛试题.docx_第4页
第4页 / 共14页
GDCC程序设计大赛决赛试题.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

GDCC程序设计大赛决赛试题.docx

《GDCC程序设计大赛决赛试题.docx》由会员分享,可在线阅读,更多相关《GDCC程序设计大赛决赛试题.docx(14页珍藏版)》请在冰豆网上搜索。

GDCC程序设计大赛决赛试题.docx

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

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

当前位置:首页 > 自然科学 > 物理

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

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