import random
a=['A','B','#','#','C','D','#']
stk=[0]*len(a);top=-l
for i in range(len(a)):
op=random. randint(0,1) # 随机生成0或1
if op= =l and a[i]!='#":
top+=l;stk[top]=a[i]
a[i]='#'
elif op= =0 and top!=-1 and a[i]= ='#':
a[i]=stk[top];top-=l
执行该程序段后,a的值
A.['A','B','#','#','C','D','#'] | B.['#','#','#','#','#','#','#'] |
C.['#','B','#','#','C';'D','A'] | D.['#','#','A','B','C','D','#'] |

同类型试题

y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2


y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2

