给定正整数 n(1≤n≤26),要得到中间以“A”开始,两边各递增 n-1 个字符的对称字符串s,例如 n=5,则 s=“EDCBABCDE”。实现该功能的 VB 程序段如下:
s = ""
For i = 2 * n - 1 To 1 Step -1
If i <= n Then
S=
Else
S=
End If
Next i
上述程序段方框处的语句分别为:( )
- A、Chr(Asc("A") + n - i) + s 和Chr(Asc("A") + i - n) + s
- B、Chr(Asc("A") + n - i) + s和s + Chr(Asc("A") + i - n)
- C、Chr(Asc("A") + n – i+1) + s和Chr(Asc("A") + i – n+1) + s
- D、Chr(Asc("A") + n - i) + s和s + Chr(Asc("A") + i – n+1)