上海交通大学2005-2007年计算机上机真题附答案

本站小编 免费考研网/2016-08-04

2005 年上机试题
发信人: tiancai (tiancai), 信区: KaoyanExam
标 题: Re: 问:今年cs 上机题是什么?
发信站: 饮水思源 (2005 年04 月01 日16:10:39 星期五)
可能晚些时候会有人发出完整版本,我写一下我记到的东西:
1. 太恐怖了,
12 翻一下是21 对吗?
34 翻一下是43 对吗?
12+34 是46 对吗?46 翻一下是64 对吗?
现在给你21 与43,把64 输出就可以了。
2.
给你一串路径,譬如
a\b\c
a\d\e
b\cst
d
你把这些路径中蕴涵的目录结构给画出来,子目录直接列在父目录下面,并比父目录向右
缩一格,就象这样
a
b
c
d
e
b
cst
d

1

同一级的需要按字母顺序排列,不能乱。
3. 这题听说.....有点问题。反正大概意思是这样的(除非我理解错了.....):
有一个x[6][6] 任意的 0<=i,j<=5 1<=x[i][j]<=10;
现在有一个起始位置i1,j1 与一个结束位置i2,j2。
请找出一条从i1,j1 到i2,j2 的总代价最小的路径。
1. 只能沿上下左右四个方向移动
2. 总代价是每走一步的代价之和
3. 每步(从a,b 到c,d)的代价是x[c][d]与其在a,b 处状态的乘积
4. 初始状态(在i1,j1 时的状态)是1,每走一步,状态按如下公式变化
(走这步的代价 % 4)+1
也就是状态只有4 种:1,2,3 or 4.
2006 年上机试题:
Problem A.Fibonacci
Input: fib.in
Output: Standard Output
Time limit: 5 second
Memory limit: 64 megabytes
The Fibonacci Numbers{0,1,1,2,3,5,8,13,21,34,55...} are defined by the recurre
nce:
F0=0 F1=1 Fn=Fn-1+Fn-2,n>=2
Write a program to calculate the Fibonacci Numbers.
Input
The input file contains a number n and you are expected to calculate Fn.(0<=n<
=30)
Output
Print a number Fn on a separate line,which means the nth Fibonacci Number.

2

Example
fib.in Standard Output
1 1

2 1
3 2
4 3
5 5
6 8

Problem B.WERTYU
Input: wertyu.in
Output: Standard Output
Time limit: 5 second
Memory limit: 64 megabytes
A common typing error is to place the hands on the keyboard one row to the rig
ht of the correct position.So "Q" is typed as "W" and "J" is typed as "K" and
so on.You are to decode a message typed in this manner.

` 1 2 3 4 5 6 7 8 9 0 - = BackSp
Tab Q W ERT Y U I O P [] \
A SD F G HJ KL ; ' Enter
ZXCVBNM, . /
Control Alt Space Alt Control

Input
The input file consist of several lines of text.Each line may contain digits,s
paces,upper case letters(except Q,A,Z),or punctuation shown above(except back-
quote(') which is left to the key "1").Keys labelled with words [Tab,BackSp,Co
ntrol,etc.] are not represented in the input.


Output
You are to replace each letter or punctuation symbol by the one immediately to
its left on the QWERTY keyboard shown above.Spaces in the input should be ech
oed in the output.

Example
wertyu.in Standard Output
O S, GOMR YPFSU/ I AM FINE TODAY.

Problem C.String Matching

Input: matching.in
Output: Standard Output
Time limit: 5 second

Memory limit: 64 megabytes
Finding all occurrences of a pattern in a text is a problem that arises freque
ntly in text-editing programs.

Typically,the text is a document being edited,and the pattern searched for is
a particular word supplied by the user.

We assume that the text is an array T[1..n] of length n and that the pattern i
s an array P[1..m] of length m<=n.We further assume that the elements of P and
T are all alphabets(Σ={a,b...,z}).The character arrays P and T are often cal
led strings of characters.

We say that pattern P occurs with shift s in the text T if 0<=s<=n and T[s+1..
s+m] = P[1..m](that is if T[s+j]=P[j],for 1<=j<=m).

If P occurs with shift s in T,then we call s a valid shift;otherwise,we call s


a invalid shift.

Your task is to calculate the number of vald shifts for the given text T and p
attern P.

Input
In the input file,there are two strings T and P on a line,separated by a singl
e space.You may assume both the length of T and P will not exceed 10^6.

Output
You should output a number on a separate line,which indicates the number of va
lid shifts for the given text T and pattern P.

Example
matching.in Standard Output
aaaaaa a 6

abababab abab 3
abcdabc abdc 0


相关话题/计算机

  • 领限时大额优惠券,享本站正版考研考试资料!
    大额优惠券
    优惠券领取后72小时内有效,10万种最新考研考试考证类电子打印资料任你选。涵盖全国500余所院校考研专业课、200多种职业资格考试、1100多种经典教材,产品类型包含电子书、题库、全套资料以及视频,无论您是考研复习、考证刷题,还是考前冲刺等,不同类型的产品可满足您学习上的不同需求。 ...
    本站小编 Free壹佰分学习网 2022-09-19
  • 2008年上海交通大学计算机考研复试上机试题
    本站小编 免费考研网 2016-08-04
  • 2016年东北大学计算机专业基础考研真题(完整版)
    2016年东北大学计算机专业基础考研真 题(完整版)凯程首发 一、简答 1、 循环语句while和dowhile的区别。 2、 有static声明的局部变量和自由变量的区别。 3、 根据 4、Int (*p)[4]和int *p[4]的区别 二、写出程序运行的结果 有一个是用指针作函数参数,实现数据的交换 有一个是a[9]={1, ...
    本站小编 免费考研网 2016-07-31
  • 2009-2015年计算机组成原理考研大题
    43.(8 分)某计算机的 CPU 主频为 500MHz,CPI 为 5(即执行每条指令平均需 5 个时钟周期)。假定某外设的数据传输率为 0.5MB/s,采用中断方式与主机进行数据传送,以 32 位为传输单位,对应的中断服务程序包含 18 条指令,中断服务的其他开销相当于 2 条指 令的执行时间。请回答下列问题,要求给出计算过程。 (1) ...
    本站小编 免费考研网 2016-07-31
  • 2009-2015年计算机组成原理考研选择题
    11.冯诺依曼计算机中指令和数据均以二进制形式存放在存储器中,CPU 区分它们的依据是 。 A.指令操作码的译码结果 B.指令和数据的寻址方式 C.指令周期的不同阶段 D.指令和数据所在的存储单元 11.C。考查指令的执行过程。 通常完成一条指令可分为取指阶段和执行 ...
    本站小编 免费考研网 2016-07-31
  • 计算机科学与技术考研报考注意事项
    计算机科学与技术考研报考注意事项 近几年由于专业的热门和考研竞争的异常激烈,因此国内一些重点院校的计算机专业硕士生入学分数都非常高,这种情况在一些重点院校特别突出。报考计算机专业研究生的朋友一定要充分地认清这种现实情况,做好充分的准备,思想上要树立考试胜利的信心,并且做好刻苦复习 ...
    本站小编 免费考研网 2016-07-27
  • 计算机科学与技术专业解析
    计算机科学与技术专业解析  一、培养目标   本专业培养和造就适应现代化建设需要。德智体全面发展、基础扎实、知识面宽、能力强、素质高具有创新精神,系统掌握计算机硬件、软件的基本理论与应用基本技能,具有较强的实践能力,能在企事业单位、政府机关、行政管理部门从事计算机技术研究和应用 ...
    本站小编 免费考研网 2016-07-27
  • 计算机软件与理论就业方向与就业前景
    计算机软件与理论就业方向与就业前景 计算机科学与技术专业介绍   计算机科学与技术是研究计算机的设计与制造,以及信息获取、表示、存储、处理、传输和利用等方面的理论、原则、方法和技术的学科。它包括科学与工程技术两方面,两者互为作用,高度融合,这是计算机科学与技术学科的突出特点。计 ...
    本站小编 免费考研网 2016-07-27
  • 计算机应用技术就业方向与就业前景
    计算机应用技术就业方向与就业前景 计算机应用技术专业介绍   计算机应用技术是计算机科学与技术专业下设的一个二级学科,某些院校可以授予理学学位,在此针对工学学位进行解析。本学科主要研究计算机各种应用中具有共性的理论、技术和方法,以及各种前沿性、创新性的计算机应用。   计算 ...
    本站小编 免费考研网 2016-07-27
  • 计算机系统结构就业方向与就业前景
    计算机系统结构就业方向与就业前景 计算机系统结构专业介绍   计算机系统结构是计算机科学与技术专业下设的二级学科。某些院校可以授予理学学位,在此针对工学学位进行解析。计算机系统结构是计算机的的机器语言程序员或编译程序编写者所看到的外特性。所谓外特性,就是计算机的概念性结构和功能 ...
    本站小编 免费考研网 2016-07-27
  • 北京邮电大学计算机学院简介
    北京邮电大学计算机学院简介 北京邮电大学计算机学院源于1985年9月成立的北京邮电大学计算机工程系,后经多次机构调整和更名,2008年9月由计算机科学与技术专业、网络工程专业、智能科学与技术专业和信息安全专业合并形成了现在的计算机学院。   计算机学院是全校规模大、综合实力强的 ...
    本站小编 免费考研网 2016-07-27