Skip to content

Instantly share code, notes, and snippets.

@joonas-yoon
Last active June 9, 2020 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joonas-yoon/2c29589552510e2ed9f4172e502a67ef to your computer and use it in GitHub Desktop.
Save joonas-yoon/2c29589552510e2ed9f4172e502a67ef to your computer and use it in GitHub Desktop.
문제적 남자 95화 - 리모트 뷰잉 뇌풀기 - 4번 문제
from itertools import permutations
# AB*C = DE-F = GH/I
def validate(a):
ABC = (10*a[0] + a[1]) * a[2]
DEF = (10*a[3] + a[4]) - a[5]
if ABC != DEF:
return False
GH, I = 10*a[6] + a[7], a[8]
if GH % I != 0 or ABC != (GH / I):
return False
return True
a = [i for i in range(1, 10)]
for p in permutations(a):
if validate(p):
print(p)
for i in range(len(p)):
print("{} = {}".format(chr(ord('A') + i), p[i]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment