作者qwaszx1 (qwaszx1)
看板Grad-ProbAsk
标题[问题] 计概问题
时间Thu Mar 26 00:49:09 2009
1.Decode the following ASCII code: 1010011 1110100 1100001 1110010 0110010
(hint: ASCII (0)=30H, ASCII (A)=41H, ASCII (a)=61H)
ps.请问这个要怎麽做解码呢?
2. Here is a series of address references given as word addresses:
1, 4, 8, 5, 20, 17, 19, 56, 9, 11, 4, 43, 5, 6, 9, 17
Assuming a direct-mapped cache with 16 one-word blocks that is initially
empty, label each reference in the list as a hit or a miss and show the final
contents of the cache.
PS.这题看不懂题目 也不会算耶 请大大帮忙解惑喔
3.Given the Fibonacci number as
1 2 5 8 13 21 ……
Write an object-oriented program to generate the Fibonacci number N
int fibonacci(int n)
{
if(n <= 0)
return 0;
else if(n = = 1)
return 1;
else
return fibonacci(n-1) + fibonacci(n-2);
}
上面是我自己写的@@ 可是感觉上题目要我写得好像不是这个程式码耶
因为题目给的前面两个数相加 并没有等於第三个数
比如题目给 1 2 1+2 ≠ 5 2+5≠8
但是从第三个数字 就是8+5=13 8+13=21 (前面两个数相加 等於第三个数)
所以是我上面程式码还要再做怎样的更改呢?
还是说这就是对的程式码呢?
先谢谢大大的解惑唷~
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 118.161.128.117
1F:推 hateexam:第三题 前三个给定初始值f(1)=1,f(2)=2,f(3)=5 03/26 11:01