标签:elf object type png pre def range 题目 ==
这道题为简单题
这个题思路挺简单的,主要的就是先把数字拆分,然后再循环判断
1 class Solution(object): 2 def selfDividingNumbers(self, left, right): 3 """ 4 :type left: int 5 :type right: int 6 :rtype: List[int] 7 """ 8 out = [] 9 for i in range(left, right+1): 10 a = list(str(i)) 11 for j in range(len(a)): 12 if int(a[j]) == 0: 13 break 14 elif i % int(a[j]) != 0: 15 break 16 elif j == len(a)-1: 17 out.append(i) 18 return out
标签:elf object type png pre def range 题目 ==
原文地址:http://www.cnblogs.com/liuxinzhi/p/7896921.html