Skip to content

Instantly share code, notes, and snippets.

@andriiburka
Created January 29, 2020 15:55
Show Gist options
  • Save andriiburka/60b41a411f25765f37995baa6094a7b9 to your computer and use it in GitHub Desktop.
Save andriiburka/60b41a411f25765f37995baa6094a7b9 to your computer and use it in GitHub Desktop.
90/100 (Runtime Error)
from itertools import chain, permutations
n1 = input()
n2 = input()
n3 = input()
str_nums = []
str_nums.append(n1), str_nums.append(n2), str_nums.append(n3)
divider = int(n1) + int(n2) + int(n3)
is_successful = False
loops = set(["".join(perm) for perm in chain.from_iterable(permutations(str_nums, len(str_nums)) for n in range(4))])
for i in loops:
number = int(i)
if number % divider == 0:
is_successful = True
if is_successful:
print('Digitivision successful!')
else:
print('No digitivision possible.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment