python 1121: 电梯
作者:互联网
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)
标签:map,elif,fabs,python,1121,int,电梯,input,math 来源: https://blog.csdn.net/m0_52141241/article/details/111604169