作者tim77928 (tim)
看板TransCSI
標題[問題] 99年彰師遞迴
時間Tue Jun 21 23:48:27 2011
given the following function, what is the value of Funny(4)
public static int Funny(int n){
if(n==1) return 1;
if(n==2) return 2;
else return Funny(n-1)+Funny(n-2)+3;
}
A.6 B.7 C.8 D.9 E.10
我算出來是11....是答案有錯嗎= =a還是我算錯呢T^T
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 125.229.169.99
推 stator:11 06/22 07:33
推 TonyJih:11 = =...剛才耍笨了 06/22 11:09
推 Pix911:8? 07/15 20:02
→ Pix911:f4=f3+f2+3=f2+f1+3+f2+3=2+1+3+2+3=11 唉呀..我也耍笨了 07/15 20:04