tmps=[32,28,26,29]
n=len(tmps);top=-1
ans=[0]*n
stk=[-1]*n
for i in range(n):
t=tmps[i]
while top>-1 and t>tmps[stk[top]]:
d=stk[top]
top-=1
ans[d]=i-d
top+=1
stk[top]=i
print(ans)
执行该程序段后,输出的结果是( )
A.[1,0,0,1] | B.[1,1,0,0] |
C.[0,2,1,0] | D.[0,1,2,0] |

同类型试题

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

