class Solution:
def MinimumTimes(self , arr ): """ 找规律 0, 3, 4, 1, 2, 3, 2, 1, 2, 3, 2, 1, 4, 3, 2, 3, 4, 3, 2, 3, 4, 3, 2, 5, 4, 3, 4, 5, 4, 3, 4, 5, 4, 3, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 7, 6, 5, 6, 7, 6, 5, 6, 7, 6, 5, 8, 7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 9, 8, 7, 8, 9, 8, 7, 8, 9, 8, 7 """ # dp_init = self.__solve_table(100) dp_init = [0, 3, 4, 1, 2, 3, 2, 1, 2, 3, 2, 1, 4, 3, 2, 3, 4, 3, 2, 3, 4, 3, 2, 5, 4, 3] rnt = list() for num in arr: if num < len(dp_init): rnt.append(dp_init[num]) continue tmp = int(num % 11) if tmp == 0: rnt.append(num // 11) continue if tmp in [3, 7]: rnt.append(num // 11 + 1) continue if tmp < 3: rnt.append(num // 11 + 4 - tmp) elif tmp == 4: rnt.append(num // 11 + 2) elif tmp == 5: rnt.append(num // 11 + 3) elif tmp == 6: rnt.append(num // 11 + 2) elif tmp == 8: rnt.append(num // 11 + 2) elif tmp == 9: rnt.append(num // 11 + 3) elif tmp == 10: rnt.append(num // 11 + 2) return rnt