#80分求助(一个WA),请大佬帮忙看看
查看原帖
#80分求助(一个WA),请大佬帮忙看看
1523554
shallowyu楼主2024/11/23 12:50

#80分求助(一个WA),请大佬帮忙看看

n=int(input())
a=input().split()
c=[]
x=[]
b=1
for i in a:
   d=int(i)
   c.append(d)
for i in range(1,n):
    if (c[i]-c[i-1])==1:
        b+=1
    else:
        x.append(b)
        b=1
x.sort()
n=len(x)
if x[n-1]==0:
    x[n-1]=0
print(x[n-1])
2024/11/23 12:50
加载中...