a=[21,5,10,9,18,10,5,18,12,11]
n=len(a)
st=[0]*n; top=-1
for i in range(n):
if top==-1:
top+=1
st[top]=a[i]
else:
if a[i]%2==0:
while top>-1 and a[i]>st[top]:
top-=1
top+=1
st[top]=a[i]
while top>-1:
print(st[top], end=“ ”)
top-=1
执行该程序段后,输出结果为( )
A.12 18 18 21 | B.18 18 12 | C.21 18 18 12 | D.10 10 12 18 18 |

同类型试题

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

