程式設計-手寫題 - 考試
By Irma
at 2013-09-30T21:41
at 2013-09-30T21:41
Table of Contents
: 下列程式輸出為何?
: CLS
: S = 0
: FOR K = 1 TO 10
: FOR I = 0 TO (K - 1)
: FOR J = 0 TO (K - 1)
: IF I < > J THEN S = S + 1
: NEXT J
: NEXT I
: NEXT K
: PRINT S
: END
: [解答]
原文43
k=1 2 3
i=0 0 1 0 1 2
j=0 0 1 0 1 0 1 2 0 1 2 0 1 2
s=0 0 1 2 2 2 3 4 5 5 6 7 8 8
...以下略
可以漸漸地看出
k增長的時候
s會有規律地增加
k次增加
增量為k-1
舉例來說就是k=5 會有5次增加,每次增加4
所以k=5那一次會增加20
如此就可以推得k=1~10總量是多少了
--
: CLS
: S = 0
: FOR K = 1 TO 10
: FOR I = 0 TO (K - 1)
: FOR J = 0 TO (K - 1)
: IF I < > J THEN S = S + 1
: NEXT J
: NEXT I
: NEXT K
: PRINT S
: END
: [解答]
原文43
k=1 2 3
i=0 0 1 0 1 2
j=0 0 1 0 1 0 1 2 0 1 2 0 1 2
s=0 0 1 2 2 2 3 4 5 5 6 7 8 8
...以下略
可以漸漸地看出
k增長的時候
s會有規律地增加
k次增加
增量為k-1
舉例來說就是k=5 會有5次增加,每次增加4
所以k=5那一次會增加20
如此就可以推得k=1~10總量是多少了
--
Tags:
考試
All Comments
By Catherine
at 2013-10-01T09:01
at 2013-10-01T09:01
By Dinah
at 2013-10-03T10:40
at 2013-10-03T10:40
By Daph Bay
at 2013-10-04T16:08
at 2013-10-04T16:08
By Odelette
at 2013-10-06T03:10
at 2013-10-06T03:10
By Jessica
at 2013-10-08T15:12
at 2013-10-08T15:12
By Hedy
at 2013-10-13T10:09
at 2013-10-13T10:09
By Kyle
at 2013-10-16T15:02
at 2013-10-16T15:02
Related Posts
vb程式疑問
By Linda
at 2013-09-30T21:09
at 2013-09-30T21:09
行政法(訴願機關)
By Skylar DavisLinda
at 2013-09-30T20:54
at 2013-09-30T20:54
明年初考 下月中開放報名
By Enid
at 2013-09-30T19:35
at 2013-09-30T19:35
103年初考錄取名額
By Freda
at 2013-09-30T19:13
at 2013-09-30T19:13
統計實務
By Harry
at 2013-09-30T17:59
at 2013-09-30T17:59