A: j = 0
B: P[j] = P[next[j] - 1]
C: T[j] = P[j]
D: P[j] = P[next[j]]
举一反三
- 令 A = {t | P[0, t) = P[j - t, j)} ,即A是所有使得P[0,j)的前缀与后缀相等的长度t,如何计算next[j]? A: next[j] = min A B: next[j] = max A C: next[j] = |A| (A中的元素个数) D: next[j] = max A - |A|
- 下面____程序段不能正确显示1!、2!、3!、4!的值。 A: For I=1 To 4 n=1 For j=1 to I n=n*j Next j Print n Next I B: For I=1 To 4 For j=1 to I n=1 n=n*j Next j Print n Next I C: n=1 For j=1 to 4 n=n*j Print n Next j D: n=1:j=1 Do While j<=4 n=n*j Print n j=j+1Loop
- 下列程序段能且只能显示1!、2!、3!、4!的值的是( )。 A: For i = 1 To 4 n = 1 For j = 1 To i n = n * j Next j MsgBox(n)Next i B: For i = 1 To 4 For j = 1 To i n = 1 n = n * j Next j MsgBox(n)Next i C: n = 1For i = 1 To 4 For j = 1 To 4 n = n * j MsgBox(n) Next jNext i D: n = 1j = 1Do While j <= 4 n = n * j j = j + 1LoopMsgBox(n)
- 下列程序段不能正确显示1!、2!、3!、4!的结果的是 。 A: For i = 1 To 4 For j = 1 To i n = 1 n = n * j Next j MsgBox( n)Next i B: Dim i%, j%, n%For i = 1 To 4 n = 1 For j = 1 To i n = n * j Next j MsgBox( n)Next i C: Dim j%, n%n = 1For j = 1 To 4 n = n * j MsgBox( n)Next j D: Dim j%, n%n = 1j = 1Do While j<=4 n=n*j MsgBox(n) j=j+1Loop E: Dim j%, n%n = 1j = 1Do n=n*j MsgBox(n) j=j+1Loop While j<=4
- 以下程序段执行后p的值是( )。int a[3][3]={3,2,1,3,2,1,3,2,1}; int j,k,p=1;for(j=0;j<2;j++)for(k=j;k<3;k++)p*=a[j][k];
内容
- 0
假设有以下程序段: For i=1 to 3 For j=5 to 1 Step -1 Next j Next i Print i,j 则i、j的值分别是
- 1
下列程序段能分别正确显示1!、2!、3!、4!的值的是______。 A: For i = 1 To 4 n = 1 For j = 1 To i n = n * j MsgBox(n) Next jNext i B: For i = 1 To 4 For j = 1 To i n = 1 n = n * j Next j MsgBox(n)Next i C: n = 1For i = 1 To 4 For j = 1 To 4 n = n * j MsgBox(n) Next jNext i D: n = 1j = 1Do While j <= 4 n = n * j MsgBox(n) j = j + 1Loop
- 2
执行下面的程序段后,循环参数i、j的值分别为() For i=1 to 3 For j=4 to 1 setp -1 Print i*j Next j Next i
- 3
下列程序段的执行结果为 _______。 Dim a(3, 5) As Integer Dim i As Integer, j As Integer For i = 1 To 3 For j = 1 To 5 a(i, j) = a(i - 1, j - 1) + (i - 1) * 5 + j Next j Next i Print a(3, 4)
- 4
以下程序段执行后p的值是( )。int a[3][3]={3,2,1,3,2,1,3,2,1}; int j,k,p=1;for(j=0;j<2;j++)for(k=j;k<3;k++)p*=a[j][k]; A: 108 B: 18 C: 12 D: 2