Heir's Dilemma
This commit is contained in:
28
heirsdilemma.py
Normal file
28
heirsdilemma.py
Normal file
@@ -0,0 +1,28 @@
|
||||
def div_by_all(nr: int) -> bool:
|
||||
digits = nr
|
||||
for i in range(1, 7):
|
||||
digit = digits % (10**i)
|
||||
if nr % (digit // (10 ** (i - 1))) != 0:
|
||||
return False
|
||||
digits -= digit
|
||||
return True
|
||||
|
||||
|
||||
low, high = map(int, input().split())
|
||||
|
||||
if low % 2 == 1:
|
||||
low += 1
|
||||
|
||||
total = 0
|
||||
|
||||
for i in range(low, high + 1, 2):
|
||||
u = set(str(i))
|
||||
if len(u) != len(str(i)):
|
||||
continue
|
||||
if "0" in u:
|
||||
continue
|
||||
|
||||
if div_by_all(i):
|
||||
total += 1
|
||||
|
||||
print(total)
|
||||
Reference in New Issue
Block a user