zltzlt
发表于 2020-3-20 17:47:12
小甲鱼de粉丝 发表于 2020-3-18 19:33
这个,抱歉,发现有bug
输入 elft = 47, right = 85 有错,结果多了个 1
zltzlt
发表于 2020-3-20 17:50:55
fan1993423 发表于 2020-3-19 18:33
楼主是不是我最快,是最佳答案啊
好像有人比你快哦
小甲鱼de粉丝
发表于 2020-3-20 21:37:38
zltzlt 发表于 2020-3-20 17:47
输入 elft = 47, right = 85 有错,结果多了个 1
def day354(left, right):
if not(left < 1):
numberlist = []
nnl = []
for i in range(left ,right):
numberlist.append(i + 1)
for i in range(len(numberlist)):
pass2 = 1
number = numberlist
nlist = list(str(number))
pass1 = 0
for i2 in nlist:
if i2 == "0":
pass2 = 0
if not(pass2 == 0):
for each in range(len(str(number))):
if int(nlist) == 0:
pass1 += 1
elif number % int(nlist) == 0:
pass1 += 1
if pass1 == len(str(number)):
nnl.append(number)
print(nnl)
def day354(left, right):
if not(left < 1):
numberlist = []
nnl = []
for i in range(left ,right):
numberlist.append(i + 1)
for i in range(len(numberlist)):
pass2 = 1
number = numberlist
nlist = list(str(number))
pass1 = 0
for i2 in nlist:
if i2 == "0":
pass2 = 0
if not(pass2 == 0):
for each in range(len(str(number))):
if int(nlist) == 0:
pass1 += 1
elif number % int(nlist) == 0:
pass1 += 1
if pass1 == len(str(number)):
nnl.append(number)
print(nnl)
sYMMetrY
发表于 2020-3-21 12:11:43
zltzlt 发表于 2020-3-19 17:44
解答错误
输入:left = 47, right = 85
left = 47
right = 85
def q354(left, right):
DivSelf = []
for each in range(left, right+1):
if '0' not in (string := str(each)):
count = 0
for key in (num := set(string)): #之前的判定条件为:将存在于该数(A)中的不相同元素相乘所得(B)相除(A%B)余数为0就可判定是不能满足的,比如48
if each%(int(key)) == 0:#将判定条件改为:若每个元素都可以被A整除 那么一定为自除数,但是计算迭代次数增加(最多计算9次)
count += 1
if count == len(num):
DivSelf.append(each)
count = 0
return DivSelf
快马加鞭未下鞍
发表于 2020-3-29 10:22:32
a=int(input('请输入一个整数:'))
def increase(a):
b=[]
while 1:
c=a%10
a=a//10
b.append(c)
if a==0:
break
return b
while a:
m=increase(a)
l=len(m)
b=0
for i in range(l-1):
if m>=m:
b+=1
if b==l-1:
print(a)
break
a-=1
776667
发表于 2020-8-10 14:03:58
def fun354(left,right):
def self_counting(x):
if '0' in str(x):
return False
list_counting =
if len(set(list_counting)) != 1:
return False
return True
result =
return result