[试题] 103-1 廖婉君 计算机程式 期中考

楼主: yangchris11 (歪彦)   2014-11-17 12:01:41
课程名称︰计算机程式
课程性质︰电机系大一必修
课程教师︰廖婉君
开课学院:电资学院
开课系所︰电机工程学戏
考试日期(年月日)︰2014/11/11
考试时限(分钟):180分钟(上机考)
是否需发放奖励金:是
(如未明确表示,则不予发放)
试题 :
Problem1 (10%)
已知费波那契数列的前几项为={1,1,2,3,5,8,13............},求前二十五项
费坡那契数列的平均值,精度到小数点下两位。
Please directly output the average.
Problem2 (10%)
假设有一多项式形式为
f(x) = a0*x^n + a1*x^(n-1) + ........ + an 求函数值。
Please implement the following function
double polynomial( double *a, int n , double x )
Problem3 (15%)
试作一函式求x,y两数的最大公因子。
Please implement the following function
int gcd( int x , int y )
Problem4 (20%)
给予两矩形分别的长、宽以及中心位置,试求两矩形所重叠的面积。
(coor[0][0],coor[0][1]) = A矩形的中心位置
(coor[1][0],coor[1][1]) = B矩形的中心位置
dim[0][0] = A矩形在x方向的长度
dim[0][1] = A矩形在y方向的长度
dim[1][0] = B矩形在x方向的长度
dim[1][1] = B矩形在y方向的长度
Please implement the following function
void enclosedArea( double coor[2][2] , double dim[2][2] , double &output )
Problem5 (15%)
就...质因子分解。
Please prompt the user to input an integer between 2~10000 and output
the prime factorization in the following format
Sample Input 1: 100
Sample Output 1: (2^2)*(5^2)
Sample Input 2: 7
Sample Output 2: (7^1)
Problem6_1 (5%)
计算input字串的字符长度。注意!不能使用内建的函式。
Please implement the following function
int getStringLength(char *s1)
Problem6_2 (15%)
有两个字串s1、s2,并且确定s1长度>=s2长度,求s2字串在s1字串里
重复出现的次数。
Please implement the following function
int countString ( char *s1 , char *s2 )
Sample Input: s1 = mimim ; s2 = mi
Sample Output: 2
试题完
==================================================================
备注:
(1) 全卷英文出题,助教会讲解一次题目,不懂可以一直问。
(2) 计中只有雷雷的VS,可以提早到教室灌其他编译器。
(3) 助教测资(5~10笔)很雷xDDDDD,有时候要相信自己是对的。
(4) 使用的是judgegirl批改娘,可以一直送一直送一直送,分数一样。

Links booklink

Contact Us: admin [ a t ] ucptt.com