[試題] 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