b站笔试开发C端题解0829
两道行数加起来都没我年龄大的题,难度不多说了 bilibili笔试,哔哩哔哩笔试
T1 找bilibili型数字的个数
def DoubleNumber(self , n ): ans, l = 0, len(str(n)) for i in range(1, (l+1)//2): ans += 10**i-10**(i-1) if l%2==0: for i in range(10**(l//2-1), int(str(n)[:l//2])+1): if int(str(i)*2)<=n: ans+=1 return ans
T2电梯
n = int(input()) times = list(map(int, input().split())) lifts, cur = [0, 0], 0 for time in times: mi = min(lifts) index, cur = lifts.index(mi), cur+mi lifts[index], lifts[1-index] = lifts[index]-mi+time, lifts[1-index]-mi print(cur+max(lifts))