import math
a=int(input())
b=list(map(int,input().split()))#将输入变为彻底的列表(纯数字)
c=d=0
for i in range(a):
if b[i]>c:
d+=math.fabs(int(b[i])-c)*6+5
elif b[i]==c:
d+=5
else:
d+=math.fabs(int(b[i])-c)*4+5
c=b[i]
print(’%d’%d)
2024-04-08 15:36:58
import math
a=int(input())
b=list(map(int,input().split()))#将输入变为彻底的列表(纯数字)
c=d=0
for i in range(a):
if b[i]>c:
d+=math.fabs(int(b[i])-c)*6+5
elif b[i]==c:
d+=5
else:
d+=math.fabs(int(b[i])-c)*4+5
c=b[i]
print(’%d’%d)