浙江大学计算机专业课考研复试上机真题
2011浙江大学复试上机

1001: A+B for Matrices时间限制:1 Sec 内存限制:32 MB提交:931 解决:514题目描述This time, you are supposed to find A+B where A and B are two matrices, and then count the number of zero rows and columns.输入The input consists of several test cases, each starts with a pair of positive integers M and N (≤10) which are the number of rows and columns of the matrices, respectively. Then 2*M lines follow, each contains N integers in [-100, 100], separated by a space. The first M lines correspond to the elements of A and the second M lines to that of B.The input is terminated by a zero M and that case must NOT be processed.输出For each test case you should output in one line the total number of zero rows and columns of A+B.样例输入2 21 11 1-1 -110 92 31 2 34 5 6-1 -2 -3-4 -5 -6样例输出15提示来源2011年浙江大学计算机及软件工程研究生机试真题1002: Grading时间限制:1 Sec 内存限制:32 MB提交:748 解决:189题目描述Grading hundreds of thousands of Graduate Entrance Exams is a hard work. It is even harder to design a process to make the results as fair as possible. One way is to assign each exam problem to 3 independent experts. If they do not agree to each other, a judge is invited to make the final decision. Now you are asked to write a program to help this process.For each problem, there is a full-mark P and a tolerance T(<P) given. The grading rules are: • A problem will first be assigned to 2 experts, to obtain G1 and G2. If the difference iswithin the tolerance, that is, if |G1 - G2| ≤ T, this problem's grade will be the average of G1 andG2.• If the difference exceeds T, the 3rd expert will give G3.• If G3 is within the tolerance with either G1 or G2, but NOT both, then this problem's grade will be the average of G3 and the closest grade.• If G3 is within the tolerance with both G1 and G2, then this problem's grade will be the maximum of the three grades.• If G3 is within the toleranc e with neither G1 nor G2, a judge will give the final grade GJ.输入Each input file may contain more than one test case.Each case occupies a line containing six positive integers: P, T, G1, G2, G3, and GJ, as described in the problem. It is guaranteed that all the grades are valid, that is, in the interval [0, P].输出For each test case you should output the final grade of the problem in a line. The answer must be accurate to 1 decimal place.样例输入20 2 15 13 10 18样例输出14.0提示来源2011年浙江大学计算机及软件工程研究生机试真题1004: Median时间限制:1 Sec 内存限制:32 MB提交:652 解决:168题目描述Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1={11, 12, 13, 14} is 12, and the median of S2={9, 10, 15, 16, 17} is 15. The median of two sequences is defined to be the median of the non-decreasing sequence which contains all the elements of both sequences. For example, the median of S1 and S2 is 13.Given two increasing sequences of integers, you are asked to find their median.输入Each input file may contain more than one test case.Each case occupies 2 lines, each gives the information of a sequence. For each sequence, the first positive integer N (≤1000000) is the size of that sequence. Then N integers follow, separated by a space.It is guaranteed that all the integers are in the range of long int.输出For each test case you should output the median of the two given sequences in a line.样例输入4 11 12 13 145 9 10 15 16 17样例输出13提示1005: Graduate Admission时间限制:1 Sec 内存限制:32 MB提交:291 解决:50题目描述It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program to automate the admission procedure.Each applicant will have to provide two grades: the national entrance exam grade GE, and the interview grade GI. The final grade of an applicant is (GE + GI) / 2. The admission rules are: • The applicants are ranked according to their final grades, and will be admitted one by one from the top of the rank list.• If there is a tied final grade, the applicants will be ranked according to their national entrance exam grade GE. If still tied, their ranks must be the same.• Each applicant may have K choices and the admission will be done according to his/her choices: if according to the rank list, it is one's turn to be admitted; and if the quota of one's most preferred shcool is not exceeded, then one will be admitted to this school, or one's other choices will be considered one by one in order. If one gets rejected by all of preferred schools, then this unfortunate applicant will be rejected.• If there is a tied rank, and if the corresponding applicants are applying to the same school,then that school must admit all the applicants with the same rank, even if its quota will be exceeded.输入Each input file may contain more thanone test case.Each case starts with a line containing three positive integers: N (≤40,000), the total number of applicants; M (≤100), the total number of graduate schools; and K (≤5), the number o f choices an applicant may have.In the next line, separated by a space, there are M positive integers. The i-th integer is the quota of the i-th graduate school respectively.Then N lines follow, each contains 2+K integers separated by a space. The first 2 integers are the applicant's GE and GI, respectively. The next K integers represent the preferred schools. For the sake of simplicity, we assume that the schools are numbered from 0 to M-1, and the applicants are numbered from 0 to N-1.输出For each test case you should output the admission results for all the graduate schools. The results of each school must occupy a line, which contains the applicants' numbers that school admits. The numbers must be in increasing order and be separated by a space. There must be no extra space at the end of each line. If no applicant is admitted by a school, you must output an empty line correspondingly.样例输入11 6 32 1 2 2 2 3100 100 0 1 260 60 2 3 5100 90 0 3 490 100 1 2 090 90 5 1 380 90 1 0 280 80 0 1 280 80 0 1 280 70 1 3 270 80 1 2 3100 100 0 2 4样例输出0 1035 6 7 2 81 4。
浙江大学复试面试题目及答案(yyy版本)

浙江大学计算机考研历年面试问题集专业部分操作系统部分:1 windows/linux使用的文件系统?windows使用的文件系统有:FAT(包括FAT12,FAT16,FAT32),CDFS,UDF,NTFS,DFS(分布式文件系统,用于windows2000/xp服务器上的网络组件)linux使用的文件系统有:ext2,ext3,FAT32 ???????2 虚拟内存?传输协调工作,并为用户提供一个统一的界面和标准的接口,用户通过这一界面实现所需要的从操作以及使用系统资源,使系统中的若干台计算机相互协作以完成共同的任务,有效控制和协调诸任务的并行执行,并向系统提供统一的,有效的接口软件集合。
网络操作系统和分布式操作系统虽然都属于管理分布在不同地理位置上的操作系统,但最大的差别是:网络操作系统工作时必须确认网址,而分布式操作系统则不必知道计算机的确切地址;分布式系统负责整个系统的资源分配,通常能够很好的隐藏系统的内部细节,如对象的物理位置,并发控制,系统故障等。
这些对用户都是透明的。
8 操作系统为什么要用驱动程序?参考912 io调度算法?此题似乎有问题,分解之:IO控制方式:程序IO方式,中断驱动IO控制方式,DMA直接存储器访问方式,IO通道控制方式磁盘调度算法:RSS(随机调度),FIFO,PRI(进程优先级调度),LIFO,SSTF(最短作业优先),SCAN (在磁盘上往复),C-SCAN(一条道路,快速返回),N-step- SCAN(一次N个记录的SCAN),FSCAN13 一个文件重命名和把它直接删除后再重新建立新文件名有何不同?1.物理地址:前者不变,后者变化2.pcb:前者只改了文件名,后者重新建立PCB14 介绍一下os的层次结构?●多数据流:文件的实际内容被当作字节流处理,在NTFS中可以为一个文件定义多个数据流;●通用索引功能:NTFS中,每个文件都有一组属性与之关联.这样,文件管理系统中文件描述的集合组织成一个关系数据库,因而文件可以建立关于任何属性的索引.20 轮转法知道么,用在什么系统?简单介绍下分时操作系统,时间片可等长——简单轮转调度,亦可不等长——多级反馈调度数据结构部分:1 介绍分治算法,回溯算法,动态规划法?弃,其余儿子节点被加入到活节点表中。
浙大计算机学院考研复试上机试题及参考答案

浙江大学计算机复试上机2005-2007(由林子整理)2005年浙江大学计算机学院考研复试上机试题及参考答案(1/5)第一题:A+B(10分) [结题]题目要求:读入两个小于100的正整数A和B,计算A+B。
需要注意的是:A和B的每一位数字由对应的英文单词给出。
输入格式:测试输入包含若干测试用例,每个测试用例占一行,格式为"A + B =",相邻两字符串有一个空格间隔。
当A和B同时为0时输入结束,相应的结果不要输出。
输出格式:对每个测试用例输出1行,即A+B的值。
输入样例:one + two =three four + five six =zero seven + eight nine =zero + zero =输出样例:39096#include <>#include <>#include <>#include <>int main(void){const char data[12][6] = {"zero", "one","two", "three", "four","five", "six", "seven", "eight", "nine", "+", "="};unsigned a, b; /* 转换后的表达式参数,如a+b(123+456) */unsigned i, j, k; /* 临时变量,作为下标*/ char str[100]; /* 输入字符串,足够大容量*/ char temp[6]; /* 临时字符串,用于检索数字,如"one"->'1' */char result[30]; /* 转换后的表达式参数,如"123+456=" */a =b = i = j = k = 0; /* 初始化变量 */memset(str, 0, sizeof(str));memset(temp, 0, sizeof(temp));memset(result, 0, sizeof(result));gets(str); /* 获取输入字符串,不能使用scanf,因为有空格 */for(i=0, k=0; i<strlen(str); ++i){for(j=0;!isspace(str[i])&&i<strlen(str);++i,++j) /* 提取一个单词 */temp[j] = str[i];temp[j] = 0; /* 字符串结束标记 */for(j=0; j<12; j++) /* 把这个单词转换为数字 */if(strcmp(temp, data[j]) == 0){if( j <= 9 ) result[k++] = j + '0';if( j == 10 ) result[k++] = '+';if( j == 11 ) result[k++] = '=';break; /* 找到匹配数字就不必再搜索了 */ }result[k] = 0; /* 字符串结束标记,result形式"123+456=" */sscanf(result,"%d+%d=",&a,&b); /* 用sscanf来获得a,b的值 */if( a==0 && b==0 ) break; /* A,B同时为零则退出程序 */else printf("%d\n", a + b); /* 打印输出 A + B 的数值 */}while(1);return 0;}2005年浙江大学计算机学院考研复试上机试题及参考答案(2/5)第二题:谁是开门关门的人?(10分)题目要求:每天第一个到机房的人要把门打开,最后一个离开的人要把门关好。
计算机考研面试题目及答案

计算机考研面试题目及答案计算机考研面试是考生们进入硕士研究生阶段的重要关卡,在面试过程中展示自己的计算机知识水平和解决问题的能力是至关重要的。
本文将为大家提供一些常见的计算机考研面试题目及答案,以供参考。
一、数据结构1. 什么是数据结构?数据结构是计算机中存储、组织和管理数据的方式,它涉及到数据的逻辑结构和物理结构。
2. 请介绍常见的数据结构。
常见的数据结构包括数组、链表、栈、队列、树、图等。
3. 请介绍栈和队列的特点及应用。
栈是一种后进先出的数据结构,主要应用于函数的调用、表达式求值等场景;队列是一种先进先出的数据结构,主要应用于排队、调度等场景。
4. 请介绍二叉树的遍历方式。
二叉树的遍历方式包括前序遍历、中序遍历和后序遍历。
二、操作系统1. 什么是操作系统?操作系统是计算机系统中的核心软件,它管理和控制计算机硬件资源,提供给用户和其他应用程序一个方便的开发和运行环境。
2. 请介绍操作系统的功能。
操作系统的功能包括进程管理、内存管理、文件系统管理、设备管理等。
3. 请介绍进程和线程的区别。
进程是程序在计算机上的一次执行过程,具有独立的内存空间;线程是进程中执行的一个任务,多个线程可以共享同一进程的资源。
4. 请介绍死锁及如何避免死锁。
死锁是指两个或多个进程因争夺系统资源而陷入无限等待的状态。
避免死锁可以采取资源分配策略、避免循环等措施。
三、计算机网络1. 请介绍OSI七层模型。
OSI七层模型是计算机网络体系结构的标准,包括物理层、数据链路层、网络层、传输层、会话层、表示层和应用层。
2. 请介绍TCP/IP协议族。
TCP/IP协议族是互联网通信的基础协议集合,包括IP协议、TCP 协议、UDP协议等。
3. 请介绍HTTP和HTTPS的区别。
HTTP是超文本传输协议,数据传输是明文的;HTTPS是HTTP安全版,数据传输是通过SSL加密的。
4. 请介绍DNS的作用。
DNS(Domain Name System)是域名系统,用于将域名解析为对应的IP地址。
浙江大学10年计算机上机题(含答案)

一、A+B题目描述:给定两个整数A和B,其表示形式是:从个位开始,每三位数用逗号","隔开。
现在请计算A+B的结果,并以正常形式输出。
输入:输入包含多组数据数据,每组数据占一行,由两个整数A和B组成(-10^9 < A,B < 10^9)。
输出:请计算A+B的结果,并以正常形式输出,每组数据占一行。
样例输入:-234,567,890 123,456,7891,234 2,345,678样例输出:-1111111012346912答案:给大家记住数据吧,如果你是用高进度计算的。
注意:你的结果是否有前缀0;0是否带负号;999 110,000 -90 0-0 -00 -01999 1010,001 -10,000#include<iostream>#include<stdio.h>#include<stdlib.h>#include<string>using namespace std;int main(){string strA,strB;while(cin>>strA>>strB){long numA = 0;for(int i=0; i<=strA.length()-1; i++){if(strA[i] <= '9' && strA[i] >= '0'){numA = numA*10 + strA[i] - '0';}}long numB = 0;for(int//去掉否则出现变量重复i=0; i<=strB.length()-1; i++) {if(strB[i] <= '9' && strB[i] >= '0'){numB = numB*10 + strB[i] - '0';}}if(strA[0] != '-' && strB[0] != '-')//++cout<<numA+numB<<endl;if(strA[0] != '-' && strB[0] == '-')//+-cout<<numA-numB<<endl;if(strA[0] == '-' && strB[0] != '-')//-+cout<<numB-numA<<endl;if(strA[0] == '-' && strB[0] == '-')//--cout<<0-(numA+numB)<<endl;}return 0;}已AC1.//可以用sscanf把字符串转换为int,然后直接加就可以了2.#include <iostream>3.#include <cstdio>4.#include <cstring>5.ing namespace std;7.8.const int Maxn = 50;9.int main()10.{11. char str1[Maxn],str2[Maxn];12. char temp[Maxn];13. int a,b,i,r;14. while(scanf("%s%s",str1,str2)!=EOF)15. {16. int len = strlen(str1);17. memset(temp,0,sizeof(temp));18. r = 0;19. for(i = 0; i<len; i++)20. if(str1[i]!=',')temp[r++] = str1[i];21. sscanf(temp,"%d",&a);22. memset(temp,0,sizeof(temp));23. r = 0;24. for(i = 0; i<strlen(str2); i++)25. if(str2[i]!=',')temp[r++] = str2[i];26. sscanf(temp,"%d",&b);27. cout<<a+b<<endl;28. }29. return 0;30.31.}1.#include<stdio.h>2.#include<stdlib.h>3.int sw(char *a){4. int i=0,c=0;5. while(a[i]){6. if(a[i]>='0'&&a[i]<='9')7. c=c*10+a[i]-'0';8. i++;9. }10. if(a[0]=='-')11. c=-c;12. return c;13.}14.int main(){15. char a[99],b[99];16. int a1,b1,c[99],i=0;17. while(scanf("%s %s",a,b)!=EOF){18. a1=sw(a);19. b1=sw(b);20.21. c[i]=a1+b1;22. i++;}23. for(int j=0;j<i;j++)24. printf("%d\n",c[j]);25. return 0;26.}复制代码AC了二、ZOJ问题题目描述:对给定的字符串(只包含'z','o','j'三种字符),判断他是否能AC。
浙大研究生面试题目及答案

浙大研究生面试题目及答案1.PID 中P,I,D 分别什么意思,控制作用什么?答:分别表示比例,积分,微分。
比例作用:对偏差信号进行放大形成控制信号,比例作用越大,稳态偏差越小,响应速度也越快,但是稳定性会降低积分作用:对偏差信号进行积累产生控制信号,因而稳定的系统最终偏差一定为零。
但是会减小相角域度,使系统的稳定性降低。
微分作用:反应偏差信号的变化率,具有预测性,因而能加快响应速度,提高系统的稳定性,但是对噪声过于敏感,抗干扰能力差。
2.分程控制定义举例答:一个调节器去控制一个以上的阀,并按照控制信号的不同区间去操作不同的阀门。
分程控制中,阀的开闭分为异向和同向两种,同向可以满足增大可调比的要求,而异向则是满足特殊要求。
举例:蒸汽压力调节系统,锅炉产生10MPa的蒸汽压力,生产需要4MPa的平稳蒸汽压力,如果直接选择比较大的口径阀门,阀门容易产生畸变,因而用两个孔径较小的阀门同向分程控制。
3.计算机控制系统的组成答:主要由工控机和生产过程两部分组成。
工控机主要由:人机接口,主机板,内外部总线,磁盘系统,通信接口(USB,RS-232C);生产过程:执行机构,测量变送装置,被控对象。
4.设计控制系统要考虑那些问题答:1.了解被控对象特性2.选择被调节量3.选择调节量4.确定衡量标准5.确定控制规律6.选择调节阀5. 简单说说选择控制系统,并与单回路比较答:选择控制系统,在生产过程中一般起保护作用。
选择控制系统中一般有两个变量,一个是技术指标变量,这是用来形容生产质量的;另外一个是限值变量,当生产过程中,限值变量在一定的范围内,生产过程安全,当限制变量超过这个过程就有发生事故的危险,选择控制系统就会有相应的措施解决问题。
一般分为开关选择控制系统和连续选择控制系统。
正常情况下与单回路没有很大区别,当限值变量超过临界值就不同了。
6.0~20mA 的一般能否改成两线制答:不能,两线制,即电源线和信号的输出线合并起来,不仅节省电缆,而且布线方便,且大大有利于生产安全,因为减少一个通往危险现场的导线,就减少了一个窜进危险火花的门户。
浙江大学计算机学院2007年考研复试上机题

浙江大学计算机学院2007年考研复试上机题题目要求:给定一系列2维平面点的坐标(x, y),其中x和y均为整数,要求用一个最小的长方形框将所有点框在内。
长方形框的边分别平行于x和y坐标轴,点落在边上也算是被框在内。
具体的输入输出格式规定如下:输入格式:测试输入包含若干测试用例,每个测试用例由一系列坐标组成,每对坐标占一行,其中|x|和|y|小于231;一对0 坐标标志着一个测试用例的结束。
注意(0, 0)不作为任何一个测试用例里面的点。
一个没有点的测试用例标志着整个输入的结束。
输出格式:对每个测试用例,在1行内输出2对整数,其间用一个空格隔开。
第1对整数是长方形框左下角的坐标,第2对整数是长方形框右上角的坐标。
输入样例:12 5623 5613 100 012 340 00 0输出样例:12 10 23 5612 34 12 34-----------------------------------------------------------------------#include <iostream>using namespace std;int main(){int x1,y1,x2,y2,x,y;while(cin>>x>>y&&(x||y)){x1=x2=x; y1=y2=y;while(cin>>x>>y&&(x||y))x1=x1<x?x1:x,y1=y1<y?y1:y,x2=x2>x?x2:x,y2=y2>y?y2:y;cout<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<endl;}return 0;}Time limit: 1 SecondsTotal Submit: 820 Accepted Submit: 199题目要求:统计一个给定字符串中指定的字符出现的次数具体的输入输出格式规定如下:输入格式:测试输入包含若干测试用例,每个测试用例包含2行,第1行为一个长度不超过5的字符串,第2行为一个长度不超过80的字符串。
浙江大学05计算机上机题

一、A + B题目描述:读入两个小于100的正整数A和B,计算A+B.需要注意的是:A和B的每一位数字由对应的英文单词给出.输入:测试输入包含若干测试用例,每个测试用例占一行,格式为"A + B =",相邻两字符串有一个空格间隔.当A和B同时为0时输入结束,相应的结果不要输出.输出:对每个测试用例输出1行,即A+B的值.样例输入:one + two =three four + five six =zero seven + eight nine =zero + zero =样例输出:39096答案:#include <iostream>#include <string>using namespace std;int toInteger(string A){if(A=="one")return 1;else if(A=="two")return 2;else if(A=="three")return 3;else if(A=="four")return 4;else if(A=="five")return 5;else if(A=="six")return 6;else if(A=="seven")return 7;else if(A=="eight")return 8;else if(A=="nine")return 9;else if(A=="zero")return 0;elsereturn -1;}int main(){string s[1000];int i=0;while(cin>>s[i]){if(s[i]=="="&&s[i-1]=="zero"&&s[i-3]=="zero")break;i++;}for(int j=0;j!=i;){int num1=0,num2=0;int sum=0;while(s[j]!="+"){if(toInteger(s[j])==-1)return 0;elsenum1=num1*10+toInteger(s[j]);j++;}j++;while(s[j]!="="){if(toInteger(s[j])==-1)return 0;elsenum2=num2*10+toInteger(s[j]);j++;}j++;sum=num1+num2;if(sum==0)return 0;cout<<sum<<endl;}return 1;}之二:#include<stdio.h>#include<string.h>int StoInt(char s[]){if(strcmp(s,"zero")==0) return 0;if(strcmp(s,"one")==0) return 1;if(strcmp(s,"two")==0) return 2;if(strcmp(s,"three")==0) return 3;if(strcmp(s,"four")==0) return 4;if(strcmp(s,"five")==0) return 5;if(strcmp(s,"six")==0) return 6;if(strcmp(s,"seven")==0) return 7;if(strcmp(s,"eight")==0) return 8;if(strcmp(s,"nine")==0) return 9;}int main(){char a[50],b[50];int a1[10],b1[10],top1=-1,top2=-1,i,a2,b2;while(scanf("%s",a)!=EOF){if(strlen(a)==1&&a[0]=='+'){while(scanf("%s",b)!=EOF){if(strlen(b)==1&&b[0]=='='){a2=b2=0;for(i=0;i<=top1;i++){a2=a2*10+a1;}for(i=0;i<=top2;i++){b2=b2*10+b1;}if(a2==b2&&a2==0){break;}else{top1=top2=-1;printf("%d\n",a2+b2);break;}}else{b1[++top2]=StoInt(b);}}}else a1[++top1]=StoInt(a);if(a2==b2&&a2==0) break;}return 0;}AC代码。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
int min[MAXN],ret=0;
int v[MAXN],i,j,k;
for (i=0;i
min[i]=inf,v[i]=0;
for (min[j=0]=0;j
{
for (k=-1,i=0;i
if (!v[i]&&(k==-1||min[i]
k=i;
for (v[k]=1,ret+=min[k],i=0;i
}
cout<
}
return 0;
}
(注:素材和资料部分来自网络,供参考。请预览后才下载,期待你的好评与关注!)
浙江大学计算机专业课考研复试上机真题三来源:考试点
第5题:畅通工程 (8分) [prim算法,最小生成树]
题目要求:某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设计算机考研复试
输入样例:
3
1 2 1
1 3 2
2 3 4
4
1 2 1
1 3 4
1 4 1
2 3 3
2 4 2
3 4 5
0
输出样例:
3
5
#include
using namespace std;
#define MAXN 110
#define inf 1000000000
int prim(int n,int mat[][MAXN])
if (!v[i]&&mat[k][i]
min[i]=mat[k][i];
}
return ret;
}
int main()
{
int n,d[MAXN][MAXN],a,b,c;
while(cin>>n&&n)
{
for(int i=n*(n-1)/2;i;--i)
{
cin>>a>>b>>c;
d[a-1][b-1]=d[b-1][a-1]=c;
输入格式:测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( < 100 );随后的N(N-1)/2行对应村庄间的距离,每行给出一对正整数,分别是两个村庄的编号,以及此两村庄间的距离。为简单起见,村庄从1到N编号。当N为0时,输入结束,该用例不被处理。
输出格式:对每个测试用例,在1行里输出最小的公路总长度。