您的位置:首页 > 其它

140 - The 12th Zhejiang Provincial Collegiate Programming Contest(2015浙江省赛---第三部分)

2015-04-25 22:10 344 查看


EarthstoneKeeper

TimeLimit:4SecondsMemoryLimit:65536KBEarthstoneKeeperisafamousroguelikegamecreatedbyLizardEntertainment.Inthisgame,anadventurerwillexploreinasinglelayerdungeonofN×Msize.Theadventurerstartsattheroom(SR,SC)andhewantstogototheroomlocatedat(TR,TC)sincetherehidesabigtreasureboxfullofgoldanddiamonds!However,explorationisnotalwaysaneasyjob.Therearemanytrapsandmonstersinthedungeon.Tobespecific,thereare4typesofrooms:Common.Theroomissafe.Obstacles.Theroomisfullofobstaclesthattheadventurercannotenterit.Trap.Theroomhasbeensetupwithatrap.Thetrapwillbetriggeredwhentheadventurerenterstheroom.Whentheadventurerleaves,thetrapwillresetsoitcanbetriggerednexttime.Monster.Thereisamonsterstandinginit.Iftheadventurerwalksintoamonsterroomoranyroomadjacenttoamonsterroom,themonsterwillimmediatelyrushuptotheadventurerandfightwithhim.Oncethemonsteriskilled,theadventurercancontinuehisexploration.Ofcourse,themonsterwillnotrevive.Tworoomsareadjacentifandonlyiftheyshareanedge.Theadventurercantake1minutetogofromaroomtoanadjacentroom.Trapsormonstersarealwaysdangerous.Moreprecisely,thereisafatalityvalueforeachtrapandmonster.Althoughouradventurerisstrongandswift,battlingwithadeadlymonsterordodgingarollingstonetraparenotwiseoptions.Thedungeonhasbeensealedbyitsownerwithapowerfulmagicsotheadventurercannotescapetooutsideuntilhefoundthetreasure.Bytheway,beingafraidofmonstersbattlingwitheachother,thedungeonownerwillnotsetanytwomonsterroomsadjacenttoeachother.Theroom(SR,SC)and(TR,TC)arealwayscommonroomsandwillnotbeadjacenttoanymonsterroom.Theadventurerwantchooseabestpathtothetreasure.Thetotalfatalityvalueofallmonstershekilledandalltrapshetriggeredshouldbeaslowaspossible(Ifatrapwastriggeredmultipletimes,thefatalityshouldalsocountmultipletimes).Amongallsafestpaths,hewanttochoosetheshortestpathleadtothetreasureroom.Pleasewriteprogramtohelptheadventurerfindoutthebestpathtothetreasure.

Input

Therearemultipletestcases.ThefirstlineofinputcontainsanintegerTindicatingthenumberoftestcases.Foreachtestcase:ThefirstlinecontainstwointegersNandM(1<=N,M<=500).Thesecondlinecontains4integersSR,SC,TR,TC(1<=SR,TR<=Nand1<=SC,TC<=M).ForthenextNlines,eachlinecontainsMcharactersindicatingthemapofdungeon.Eachtypeofroomismarkedas:Common:"."Obstacles:"#"Trap:from"a"to"z"Monster:from"A"to"Z"Thefatalityvalueoftrap"a"andmonster"A"is1.Thefatalityvalueoftrap"b"andmonster"B"is2,andsoon.Therefore,themostdangeroustrap"z"ormonster"Z"hasitsfatalityvalueequalto26.

Output

Foreachtestcase,outputthetotalfatalityvalueandthetimecost(inminutes)ofthebestpath,separatedbyaspace.Itisguaranteedthattherealwaysexistsatleastonepathfrom(SR,SC)to(TR,TC).

SampleInput

1
35
1135
..b..
.#C#.
..a..

SampleOutput

46

没看题...

ConvertQWERTYtoDvorak

TimeLimit:2SecondsMemoryLimit:65536KBEdward,apoorcopytypist,isauseroftheDvorakLayout.ButnowhehasonlyaQWERTYKeyboardwithabrokenCapsLockkey,soEdwardneverpressesthebrokenCapsLockkey.Luckily,alltheotherkeysontheQWERTYkeyboardworkwell.Everyday,hehasalotofdocumentstotype.ThusheneedsaconvertertotranslateQWERTYintoDvorak.Canyouhelphim?TheQWERTYLayoutandtheDvorakLayoutareinthefollowing:
TheQWERTYLayout
TheDvorakLayout

Input

AQWERTYdocumentEdwardtyped.Thedocumenthasnomorethan100kibibytes.Andtherearenoinvalidcharactersinthedocument.

Output

TheDvorakdocument.

SampleInput

JgwGqmAndpwaH.soavPatsfkf;doe
NfkGq.dslptaX,doktvdtnsaohe
Kjdyspps,glupgld;aodysokd;kgluZ
1234567890
`~!@#$%^&*()}"']_+-=ZQqWEwe{[\|
ANIHDYf.,bt/
ABCDEFuvwxyz

SampleOutput

Hi,I'mAbel,aDvorakLayoutuser.
ButI'veonlyaQwertykeyboard.
Thefollowinglinesarefortesting:
1234567890
`~!@#$%^&*()+_-={}[]:"'<>,.?/\|
ABCDEFuvwxyz
AXJE>Ugk,qf;
题意:把第一个键盘的数输入,输出是按第二个键盘;

思路:打表...

转载请注明出处:

寻找&星空の孩子
#include<iostream>#include<stdio.h>#include<string.h>#include<stack>#include<queue>#include<map>#include<set>#include<vector>#include<math.h>#include<algorithm>usingnamespacestd;#definels2*i#definers2*i+1#defineup(i,x,y)for(i=x;i<=y;i++)#definedown(i,x,y)for(i=x;i>=y;i--)#definemem(a,x)memset(a,x,sizeof(a))#definew(a)while(a)#defineLLlonglongconstdoublepi=acos(-1.0);#defineLen20005#definemod19999997constintINF=0x3f3f3f3f;chars1[]={"-=_+qwertyuiop[]QWERTYUIOP{}asdfghjkl;'ASDFGHJKL:\"zxcvbnm,./ZXCVBNM<>?"};chars2[]={"[]{}',.pyfgcrl/=\"<>PYFGCRL?+aoeuidhtns-AOEUIDHTNS_;qjkxbmwvz:QJKXBMWVZ"};charc;charprint(charc){for(inti=0;s1[i];i++)if(s1[i]==c)returns2[i];returnc;}intmain(){w(~scanf("%c",&c)){printf("%c",print(c));}return0;}
CapturetheFlag
TimeLimit:2SecondsMemoryLimit:65536KBSpecialJudge
Incomputersecurity,CapturetheFlag(CTF)isacomputersecuritycompetition.CTFcontestsareusuallydesignedtoserveasaneducationalexercisetogiveparticipantsexperienceinsecuringamachine,aswellasconductingandreactingtothesortofattacksfoundintherealworld.Reverse-engineering,networksniffing,protocolanalysis,systemadministration,programming,andcryptanalysisareallskillswhichhavebeenrequiredbypriorCTFcontestsatDEFCON.Therearetwomainstylesofcapturetheflagcompetitions:attack/defenseandjeopardy.
Inanattack/defensestylecompetition,eachteamisgivenamachine(orasmallnetwork)todefendonanisolatednetwork.Teamsarescoredonboththeirsuccessindefendingtheirassignedmachineandontheirsuccessinattackingotherteam'smachines.DependingonthenatureoftheparticularCTFgame,teamsmayeitherbeattemptingtotakeanopponent'sflagfromtheirmachineorteamsmaybeattemptingtoplanttheirownflagontheiropponent'smachine.
Recently,anattack/defensestylecompetitioncalledMCTFheldbyMarjarUniversityiscoming,andthereareNteamswhichparticipateinthecompetition.Inthebeginning,eachteamhasSpointsasinitialscore;duringthecompetition,therearesomecheckpointswhichwillrenewscoresforallteams.Therulesofthecompetitionareasfollows:
IfateamhasbeenattackedforaserviceP,theywillloseN-1points.Thelostpointswillbesplitequallyandbeaddedtotheteam(s)whichattackssuccessfully.Forexample,thereare4teamsandTeamAhasbeenattackedbyTeamBandTeamC,soTeamAwilllose3points,whileTeamBandTeamCeachwillget1.5points.Ifateamcannotmaintaintheirservicewell,theywillloseN-1points,whichwillbesplitequallytooandbeaddedtotheteam(s)whichmaintainstheservicewell.
Thescorewillbecalculatedatthecheckpointsandthenallattackswillbere-calculated.Edwardistheorganizerofthecompetitionandheneedstowriteaprogramtodisplaythescoreboardsotheteamscanseetheirscoresinstantly.Buthedoesn'tknowhowtowrite.Pleasehelphim!

Input

Therearemultipletestcases.ThefirstlineofinputcontainsanintegerTindicatingthenumberoftestcases.Foreachtestcase:
ThefirstlinecontainsfourintegersN(2<=N<=100)-thenumberofteams,Q-thenumberofservices(1<=Q<=10),S-theinitialpoints(0<=S<=100000)andC-thenumberofcheckpoints(1<=C<=100).
Foreachcheckpoint,thereareseveralparts:
ThefirstlinecontainsanintegerA-thenumberofthesuccessfulattacks.ThenAlinesfollowandeachlinecontainsamessage:
[TheNo.oftheattacker][TheNo.ofthedefender][TheNo.oftheservice]
Forexample,"123"meansthe1stteamattacksthe2ndteaminservice3successfully.TheNo.ofteamsandservicesareindexedfrom1.Youshouldnoticethatduplicatemessagesareinvalidbecauseoftherules.Justignorethem.ThenthereareQlinesandeachlinecontainsNintegers.Thejthnumberoftheithlineindicatingthejthteam'smaintainingstatusoftheithservice,where1meanswelland0meansnotwell.FinallythereisanintegerU(0<=U<=100),whichdescribingthenumberofthequeries.ThefollowinglinecontainsUintegers,whichmeansEdwardwantstoknowthescoreandtherankingoftheseteams.

Output

ForeachqueryL,outputthescoreandtherankingoftheLthteam.Therelativeerrororabsoluteerrorofthescoreshouldbelessthan10-5.Theteamwithhigherscoregetshigherrank;theteamswiththesamescoresshouldhavethesamerank.Itisguaranteedthatthescoresofanytwoteamsareeitherthesameorwithadifferencegreaterthan10-5.

SampleInput

1
4225005
0
1111
1111
4
1234
2
121
321
1111
1111
4
1234
1
122
1111
1110
4
1234
0
0000
0000
4
1234
0
1111
1111
2
14

SampleOutput

2500.000000001
2500.000000001
2500.000000001
2500.000000001
2501.500000001
2497.000000004
2501.500000001
2500.000000003
2505.500000001
2495.000000004
2502.500000002
2497.000000003
2499.500000001
2489.000000004
2496.500000002
2491.000000003
2499.500000001
2491.000000003

Hint

ForC++users,kindlyusescanftoavoidTLEforhugeinputs.队友默默A的:/article/2388646.html
DemaciaoftheAncients
TimeLimit:2SecondsMemoryLimit:65536KB
ThereisapopularmultiplayeronlinebattlearenagamecalledDemaciaoftheAncients.Therearelotsofprofessionalteamsplayingthisgame.AteamwillbeapprovedasLevelKifthereareexactKteammemberswhosematchmakingranking(MMR)isstrictlygreaterthan6000.
Youaregivenalistofteams.Pleasecalculatethelevelofeachteam.

Input

Therearemultipletestcases.ThefirstlineofinputcontainsanintegerTindicatingthenumberoftestcases.Foreachtestcase:
ThefirstlinecontainsanintegerN(1<=N<=10)indicatingthenumberofteammembers.
ThesecondlinecontainsNintegersrepresentingtheMMRofeachteammember.AllMMRsarenon-negativeintegerslessthanorequalto9999.

Output

Foreachtestcase,outputthelevelofthegiventeam.

SampleInput

3
5
79866984664562006150
5
74017377690060004300
3
800600200

SampleOutput

5
3
0
#include<iostream>#include<stdio.h>#include<string.h>#include<stack>#include<queue>#include<map>#include<set>#include<vector>#include<math.h>#include<algorithm>usingnamespacestd;#definels2*i#definers2*i+1#defineup(i,x,y)for(i=x;i<=y;i++)#definedown(i,x,y)for(i=x;i>=y;i--)#definemem(a,x)memset(a,x,sizeof(a))#definew(a)while(a)#defineLLlonglongconstdoublepi=acos(-1.0);#defineLen20005#definemod19999997constintINF=0x3f3f3f3f;intn,t,a,cnt,i;intmain(){scanf("%d",&t);w(t--){scanf("%d",&n);cnt=0;w(n--){scanf("%d",&a);if(a>6000)cnt++;}printf("%d\n",cnt);}return0;}

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐