Python求助
查看原帖
Python求助
687916
NikolaXuanwen楼主2022/5/9 14:08
from collections import deque
n=int(input())
ls=list(map(int,input().split()))
DQ=deque()
for i in range(n):
    DQ.append(i)
while len(DQ)>2:
    for i in range(len(DQ)//2):
        m=DQ.pop();n=DQ.pop()
        if ls[m]>=ls[n]:
            DQ.appendleft(m)
print(DQ.pop()+1)
2022/5/9 14:08
加载中...