浙江大学机试真题.docx

上传人:b****3 文档编号:4915350 上传时间:2022-12-11 格式:DOCX 页数:30 大小:29.52KB
下载 相关 举报
浙江大学机试真题.docx_第1页
第1页 / 共30页
浙江大学机试真题.docx_第2页
第2页 / 共30页
浙江大学机试真题.docx_第3页
第3页 / 共30页
浙江大学机试真题.docx_第4页
第4页 / 共30页
浙江大学机试真题.docx_第5页
第5页 / 共30页
点击查看更多>>
下载资源
资源描述

浙江大学机试真题.docx

《浙江大学机试真题.docx》由会员分享,可在线阅读,更多相关《浙江大学机试真题.docx(30页珍藏版)》请在冰豆网上搜索。

浙江大学机试真题.docx

浙江大学机试真题

2011年浙江大学计算机及软件工程研究生机试真题1001:

A+BforMatrices

题目描述   Thistime,youaresupposedtofindA+BwhereAandBaretwomatrices,andthencountthenumberofzerorowsandcolumns.

输入

   Theinputconsistsofseveraltestcases,eachstartswithapairofpositiveintegersMandN(≤10)whicharethenumberofrowsandcolumnsofthematrices,respectively.Then2*Mlinesfollow,eachcontainsNintegersin[-100,100],separatedbyaspace.ThefirstMlinescorrespondtotheelementsofAandthesecondMlinestothatofB.

   TheinputisterminatedbyazeroMandthatcasemustNOTbeprocessed.

输出   ForeachtestcaseyoushouldoutputinonelinethetotalnumberofzerorowsandcolumnsofA+B.

样例输入

22

11

11

-1-1

109

23

123

456

-1-2-3

-4-5-6

0

样例输出

1

5

2011年浙江大学计算机及软件工程研究生机试真题1002:

Grading

题目描述

   GradinghundredsofthousandsofGraduateEntranceExamsisahardwork.Itisevenhardertodesignaprocesstomaketheresultsasfairaspossible.Onewayistoassigneachexamproblemto3independentexperts.Iftheydonotagreetoeachother,ajudgeisinvitedtomakethefinaldecision.Nowyouareaskedtowriteaprogramtohelpthisprocess.

   Foreachproblem,thereisafull-markPandatoleranceT(

   •Aproblemwillfirstbeassignedto2experts,toobtainG1andG2.Ifthedifferenceiswithinthetolerance,thatis,if|G1-G2|≤T,thisproblem'sgradewillbetheaverageofG1andG2.

   •IfthedifferenceexceedsT,the3rdexpertwillgiveG3.

   •IfG3iswithinthetolerancewitheitherG1orG2,butNOTboth,thenthisproblem'sgradewillbetheaverageofG3andtheclosestgrade.

   •IfG3iswithinthetolerancewithbothG1andG2,thenthisproblem'sgradewillbethemaximumofthethreegrades.

   •IfG3iswithinthetolerancewithneitherG1norG2,ajudgewillgivethefinalgradeGJ.

输入

   Eachinputfilemaycontainmorethan onetestcase.

   Eachcaseoccupiesalinecontainingsixpositiveintegers:

P,T,G1,G2,G3,andGJ,asdescribedintheproblem.Itisguaranteedthatallthegradesarevalid,thatis,intheinterval[0,P].

输出

   Foreachtestcaseyoushouldoutputthefinalgradeoftheprobleminaline.Theanswermustbeaccurateto1decimalplace.

样例输入

20215131018

样例输出

14.0

2010年浙江大学计算机及软件工程研究生机试真题1003:

A+B

题目描述

给定两个整数A和B,其表示形式是:

从个位开始,每三位数用逗号","隔开。

现在请计算A+B的结果,并以正常形式输出。

输入

输入包含多组数据数据,每组数据占一行,由两个整数A和B组成(-10^9

输出

请计算A+B的结果,并以正常形式输出,每组数据占一行。

样例输入

-234,567,890123,456,789

1,2342,345,678

样例输出

-111111101

2346912

2011年浙江大学计算机及软件工程研究生机试真题1004:

Median

题目描述

   GivenanincreasingsequenceSofNintegers,themedianisthenumberatthemiddleposition.Forexample,themedianofS1={11,12,13,14}is12,andthemedianofS2={9,10,15,16,17}is15.Themedianoftwosequencesisdefinedtobethemedianofthenon-decreasingsequencewhichcontainsalltheelementsofbothsequences.Forexample,themedianofS1andS2is13.

   Giventwoincreasingsequencesofintegers,youareaskedtofindtheirmedian.

输入

   Eachinputfilemay containmorethan onetestcase.

   Eachcaseoccupies2lines,eachgivestheinformationofasequence.Foreachsequence,thefirstpositiveintegerN(≤1000000)isthesizeofthatsequence.ThenNintegersfollow,separatedbyaspace.

   Itisguaranteedthatalltheintegersareintherangeoflongint.

输出

   Foreachtestcaseyoushouldoutputthemedianofthetwogivensequencesinaline.

样例输入

411121314

5910151617

样例输出

13

2011年浙江大学计算机及软件工程研究生机试真题1005:

GraduateAdmission

题目描述

   Itissaidthatin2011,thereareabout100graduateschoolsreadytoproceedover40,000applicationsinZhejiangProvince.Itwouldhelpalotifyoucouldwriteaprogramtoautomatetheadmissionprocedure.

   Eachapplicantwillhavetoprovidetwogrades:

thenationalentranceexamgradeGE,andtheinterviewgradeGI.Thefinalgradeofanapplicantis(GE+GI)/2.Theadmissionrulesare:

   •Theapplicantsarerankedaccordingtotheirfinalgrades,andwillbeadmittedonebyonefromthetopoftheranklist.

   •Ifthereisatiedfinalgrade,theapplicantswillberankedaccordingtotheirnationalentranceexamgradeGE.Ifstilltied,theirranksmustbethesame.

   •EachapplicantmayhaveKchoicesandtheadmissionwillbedoneaccordingtohis/herchoices:

ifaccordingtotheranklist,itisone'sturntobeadmitted;andifthequotaofone'smostpreferredshcoolisnotexceeded,thenonewillbeadmittedtothisschool,orone'sotherchoiceswillbeconsideredonebyoneinorder.Ifonegetsrejectedbyallofpreferredschools,thenthisunfortunateapplicantwillberejected.

   •Ifthereisatiedrank,andifthecorrespondingapplicantsareapplyingtothesameschool,thenthatschoolmustadmitalltheapplicantswiththesamerank,evenifitsquotawillbeexceeded.

输入   Eachinputfilemaycontainmorethanonetestcase.

   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.

输出   Foreachtestcaseyoushouldoutputtheadmissionresultsforallthegraduateschools.Theresultsofeachschoolmustoccupyaline,whichcontainstheapplicants'numbersthatschooladmits.Thenumbersmustbeinincreasingorderandbeseparatedbyaspace.Theremustbenoextraspaceattheendofeachline.Ifnoapplicantisadmittedbyaschool,youmustoutputanemptylinecorrespondingly.

样例输入

1163

212223

100100012

6060235

10090034

90100120

9090513

8090102

8080012

8080012

8070132

7080123

100100024

样例输出

010

3

567

28

14

2010年浙江大学计算机及软件工程研究生机试真题1006:

ZOJ问题

题目描述

对给定的字符串(只包含'z','o','j'三种字符),判断他是否能AC。

是否AC的规则如下:

1.zoj能AC;

2.若字符串形式为xzojx,则也能AC,其中x可以是N个'o'或者为空;

3.若azbjc能AC,则azbojac也能AC,其中a,b,c为N个'o'或者为空;

输入

输入包含多组测试用例,每行有一个只包含'z','o','j'三种字符的字符串,字符串长度小于等于1000。

输出

对于给定的字符串,如果能AC则请输出字符串“Accepted”,否则请输出“WrongAnswer”。

样例输入

zoj

ozojo

ozoojoo

oozoojoooo

zooj

ozojo

oooozojo

zojoooo

样例输出

Accepted

Accepted

Accepted

Accepted

Accepted

Accepted

WrongAnswer

WrongAnswer

2010年浙江大学计算机及软件工程研究生机试真题1007:

奥运排序问题

题目描述

按要求,给国家进行排名。

输入

有多组数据。

第一行给出国家数N,要求排名的国家数M,国家号从0到N-1。

第二行开始的N行给定国家或地区的奥运金牌数,奖牌数,人口数(百万)。

接下来一行给出M个国家号。

输出

排序有4种方式:

金牌总数奖牌总数金牌人口比例奖牌人口比例

对每个国家给出最佳排名排名方式和最终排名

格式为:

排名:

排名方式

如果有相同的最终排名,则输出排名方式最小的那种排名,对于排名方式,金牌总数<奖牌总数<金牌人口比例<奖牌人口比例

如果有并列排名的情况,即如果出现金牌总数为100,90,90,80.则排名为1,2,2,4.

每组数据后加一个空行。

样例输入

44

481

662

482

2124

0123

42

8101

8112

8123

8134

03

样例输出

1:

3

1:

1

2:

1

1:

2

1:

1

1:

1

2010年浙江大学计算机及软件工程研究生机试真题1008:

最短路径问题

题目描述

给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。

输入

输入n,m,点的编号是1~n,然后是m行,每行4个数a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。

最后一行是两个数s,t;起点s,终点t。

n和m为0时输入结束。

(1

=t)

输出

输出一行有两个数,最短距离及其花费。

样例输入

32

1256

2345

13

00

样例输出

911

2010年浙江大学计算机及软件工程研究生机试真题1009:

二叉搜索树

题目描述判断两序列是否为同一二叉搜索树序列

输入

开始一个数n,(1<=n<=20)表示有n个需要判断,n=0的时候输入结束。

接下去一行是一个序列,序列长度小于10,包含(0~9)的数字,没有重复数字,根据这个序列可以构造出一颗二叉搜索树。

接下去的n行有n个序列,每个序列格式跟第一个序列一样,请判断这两个序列是否能组成同一颗二叉搜索树。

输出如果序列相同则输出YES,否则输出NO

样例输入

2

567432

543267

576342

0

样例输出

YES

NO

提示

来源

2005年浙江大学计算机及软件工程研究生机试真题1010:

A+B

题目描述

读入两个小于100的正整数A和B,计算A+B.

需要注意的是:

A和B的每一位数字由对应的英文单词给出.

输入

测试输入包含若干测试用例,每个测试用例占一行,格式为"A+B=",相邻两字符串有一个空格间隔.当A和B同时为0时输入结束,相应的结果不要输出.

输出对每个测试用例输出1行,即A+B的值.

样例输入

one+two=

threefour+fivesix=

zeroseven+eightnine=

zero+zero=

样例输出

3

90

96

2005年浙江大学计算机及软件工程研究生机试真题1011:

最大连续子序列

题目描述

   给定K个整数的序列{N1,N2,...,NK},其任意连续子序列可表示为{Ni,Ni+1,...,Nj},其中1<=i<=j<=K。

最大连续子序列是所有连续子序列中元素和最大的一个,例如给定序列{-2,11,-4,13,-5,-2},其最大连续子序列为{11,-4,13},最大和为20。

现在增加一个要求,即还需要输出该子序列的第一个和最后一个元素。

输入

   测试输入包含若干测试用例,每个测试用例占2行,第1行给出正整数K(K<10000),第2行给出K个整数,中间用空格分隔。

当K为0时,输入结束,该用例不被处理。

输出

   对每个测试用例,在1行里输出最大和、最大连续子序列的第一个和最后一个元素,中间用空格分隔。

如果最大连续子序列不唯一,则输出序号i和j最小的那个(如输入样例的第2、3组)。

若所有K个元素都是负数,则定义其最大和为0,输出整个序列的首尾元素。

样例输入

6

-211-413-5-2

10

-101234-5-2337-21

6

5-83250

1

10

3

-1-5-2

3

-10-2

0

样例输出

201113

1014

1035

101010

0-1-2

000

2005年浙江大学计算机及软件工程研究生机试真题1012:

畅通工程

题目描述   某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。

省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。

问最少还需要建设多少条道路?

输入   测试输入包含若干测试用例。

每个测试用例的第1行给出两个正整数,分别是城镇数目N(<1000)和道路数目M;随后的M行对应M条道路,每行给出一对正整数,分别是该条道路直接连通的两个城镇的编号。

为简单起见,城镇从1到N编号。

   注意:

两个城市之间可以有多条道路相通,也就是说

   33   12   12

   21   这种输入也是合法的   当N为0时,输入结束,该用例不被处理。

输出   对每个测试用例,在1行里输出最少还需要建设的道路数目。

样例输入

42

13

43

33

12

13

23

52

12

35

9990

0

样例输出

1

0

2

998

2005年浙江大学计算机及软件工程研究生机试真题1013:

开门人和关门人

题目描述

   每天第一个到机房的人要把门打开,最后一个离开的人要把门关好。

现有一堆杂乱的机房签到、签离记录,请根据记录找出当天开门和关门的人。

输入

   测试输入的第一行给出记录的总天数N(N>0),下面列出了N天的记录。

   每天的记录在第一行给出记录的条目数M(M>0),下面是M行,每行的格式为

   证件号码签到时间签离时间

   其中时间按“小时:

分钟:

秒钟”(各占2位)给出,证件号码是长度不超过15的字符串。

输出

   对每一天的记录输出1行,即当天开门和关门人的证件号码,中间用1空格分隔。

   注意:

在裁判的标准测试输入中,所有记录保证完整,每个人的签到时间在签离时间之前,且没有多人同时签到或者签离的情况。

样例输入

3

1

ME302111222532100:

00:

0023:

59:

59

2

EE30121808:

05:

3520:

56:

35

MA30113412:

35:

4521:

40:

42

3

CS30111115:

30:

28

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

当前位置:首页 > 法律文书 > 调解书

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

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