[理工] [計組]-93 中山電機
Calculate how many times the statement x=x+1 are executed after running the
following program?
------------------------------------------------------------------------------
For(I=1;I<=N;I++)
For(J=1;J<=I;J++)
For(K=1;K<=J;K++)
X=X+1
答案是:
N(N+1)(2N+1)/12+1/4(N^2+N)
這個部分不知道怎麼算出的 有想過遞迴湊不出 謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.127.43.20
→
12/08 14:51, , 1F
12/08 14:51, 1F
推
12/08 15:40, , 2F
12/08 15:40, 2F
推
12/08 15:42, , 3F
12/08 15:42, 3F
→
12/08 15:46, , 4F
12/08 15:46, 4F
推
12/08 15:56, , 5F
12/08 15:56, 5F
※ 編輯: uscer 來自: 140.116.49.82 (12/08 17:14)
推
12/09 00:03, , 6F
12/09 00:03, 6F