XXXX年浙江大学计算机及软件工程机试真题

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

本文档仅供学习和交流使用,任何组织和个人无权用于任何商业赢利活动! 第1页 共16页     2011年浙江大学计算机及软件学院机试真题        予人玫瑰,手有余香,王道论坛伴你一路同行!   感谢王道会员手工录入了这份真题,任何组织和个人无权将其用于任何商业赢利为目的的活动!本文档仅供学习和交流使用,任何组织和个人无权用于任何商业赢利活动! 第2页 共16页   A+BforMatrices(30)TimeLimit:1SecondMemoryLimit:32768KBThistime,youaresupposedtofindA+BwhereAandBaretwomatrices,andthencountthenumberofzerorowsandcolumns.InputTheinputconsistsofseveraltestcases,eachstartswithapairofpositiveintegersMandN(≤10)whicharethenumberofrowsandcolumnsofthematrices,respectively.Then2*Mlinesfollow,eachcontainsNintegersin[-100,100],separatedbyaspace.ThefirstMlinescorrespondtotheelementsofAandthesecondMlinestothatofB.TheinputisterminatedbyazeroMandthatcasemustNOTbeprocessed.OutputForeachtestcaseyoushouldoutputinonelinethetotalnumberofzerorowsandcolumnsofA+B.SampleInput221111-1-110923123456-1-2-3-4-5-60SampleOutput15  Grading(25)TimeLimit:1SecondMemoryLimit:32768KB本文档仅供学习和交流使用,任何组织和个人无权用于任何商业赢利活动! 第3页 共16页   GradinghundredsofthousandsofGraduateEntranceExamsisahardwork.Itisevenhardertodesignaprocesstomaketheresultsasfairaspossible.Onewayistoassigneachexamproblemto3independentexperts.Iftheydonotagreetoeachother,ajudgeisinvitedtomakethefinaldecision.Nowyouareaskedtowriteaprogramtohelpthisprocess.Foreachproblem,thereisafull-markPandatoleranceT(P)given.Thegradingrulesare:•Aproblemwillfirstbeassignedto2experts,toobtainG1andG2.Ifthedifferenceiswithinthetolerance,thatis,if|G1-G2|≤T,thisproblem'sgradewillbetheaverageofG1andG2.•IfthedifferenceexceedsT,the3rdexpertwillgiveG3.•IfG3iswithinthetolerancewitheitherG1orG2,butNOTboth,thenthisproblem'sgradewillbetheaverageofG3andtheclosestgrade.•IfG3iswithinthetolerancewithbothG1andG2,thenthisproblem'sgradewillbethemaximumofthethreegrades.•IfG3iswithinthetolerancewithneitherG1norG2,ajudgewillgivethefinalgradeGJ.InputEachinputfilecontainsonetestcase.Eachcaseoccupiesalinecontainingsixpositiveintegers:P,T,G1,G2,G3,andGJ,asdescribedintheproblem.Itisguaranteedthatallthegradesarevalid,thatis,intheinterval[0,P].OutputForeachtestcaseyoushouldoutputthefinalgradeoftheprobleminaline.Theanswermustbeaccurateto1decimalplace.SampleInput120215131018SampleOutput114.0SampleInput220215101116SampleOutput210.5SampleInput320215111318SampleOutput315.0SampleInput420115111318SampleOutput418.0本文档仅供学习和交流使用,任何组织和个人无权用于任何商业赢利活动! 第4页 共16页    Median(25)TimeLimit:1SecondMemoryLimit:32768KBGivenanincreasingsequenceSofNintegers,themedianisthenumberatthemiddleposition.Forexample,themedianofS1={11,12,13,14}is12,andthemedianofS2={9,10,15,16,17}is15.Themedianoftwosequencesisdefinedtobethemedianofthenon-decreasingsequencewhichcontainsalltheelementsofbothsequences.Forexample,themedianofS1andS2is13.Giventwoincreasingsequencesofintegers,youareaskedtofindtheirmedian.InputEachinputfilecontainsonetestcase.Eachcaseoccupies2lines,eachgivestheinformationofasequence.Foreachsequence,thefirstpositiveintegerN(≤1000000)isthesizeofthatsequence.ThenNintegersfollow,separatedbyaspace.Itisguaranteedthatalltheintegersareintherangeoflongint.OutputForeachtestcaseyoushouldoutputthemedianofthetwogivensequencesinaline.SampleInput4111213145910151617SampleOutput13 GraduateAdmission(20)TimeLimit:1SecondMemoryLimit:32768KBItissaidthatin2011,thereareabout100graduateschoolsreadytoproceedover40,000applicationsinZhejiangProvince.Itwouldhelpalotifyoucouldwriteaprogramtoautomatetheadmissionprocedure.Eachapplicantwillhavetoprovidetwogrades:thenationalentranceexamgradeGE,andtheinterviewgradeGI.Thefinalgradeofanapplicantis(GE+GI)/2.Theadmissionrulesare:本文档仅供学习和交流使用,任何组织和个人无权用于任何商业赢利活动! 第5页 共16页   •Theapplicantsarerankedaccordingtotheirfinalgrades,andwillbeadmittedonebyonefromthetopoftheranklist.•Ifthereisatiedfinalgrade,theapplicantswillberankedaccordingtotheirnationalentranceexamgradeGE.Ifstilltied,theirranksmustbethesame.•EachapplicantmayhaveKchoicesandtheadmissionwillbedoneaccordingtohis/herchoices:ifaccordingtotheranklist,itisone'sturntobeadmitted;andifthequotaofone'smostpreferredshcoolisnotexceeded,thenonewillbeadmittedtothisschool,orone'sotherchoiceswillbeconsideredonebyoneinorder.Ifonegetsrejectedbyallofpreferredschools,thenthisunfortunateapplicantwillberejected.•Ifthereisatiedrank,andifthecorrespondingapplicantsareapplyingtothesameschool,thenthatschoolmustadmitalltheapplicantswiththesamerank,evenifitsquotawillbeexceeded.InputEachinputfilecontainsonetestcase.Eachcasestartswithalinecontainingthreepositiveintegers:N(≤40,000),thetotalnumberofapplicants;M(≤100),thetotalnumberofgraduateschools;andK(≤5),thenumberofchoicesanapplicantmayhave.Inthenextline,separatedbyaspace,thereareMpositiveintegers.Thei-thintegeristhequotaofthei-thgraduateschoolrespectively.ThenNlinesfollow,eachcontains2+Kintegersseparatedbyaspace.Thefirst2integersaretheapplicant'sGEandGI,respectively.ThenextKintegersrepresentthepreferredschools.Forthesakeofsimplicity,weassumethattheschoolsarenumberedfrom0toM-1,andtheapplicantsarenumberedfrom0toN-1.OutputForeachtestcaseyoushouldoutputtheadmissionresultsforallthegraduateschools.Theresultsofeachschoolmustoccupyaline,whichcontainstheappl

1 / 6
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功