#随机产生 n 个两位正整数存入数组a 中
q=[-1]*n;top=-1
for i in range(n):
if a[i]%3==0 :
top+=1
q[top]=a[i]
elif a[i]>q[top] and a[i]%2==0:
while top>-1:
print(q[top],end=',')
top-=1
微信扫码预览、分享更方便