The three sheep watched in delight

Observed following addition equation:
      Cheung Ruisheng Hui
  + three sheep watched in delight
-------------------
   three sheep raw RICH

wherein like numerals representative of the same characters, different Chinese characters representing different numbers.

Calculate the "three sheep watched in delight" digital words representing the

answer format: CTF {xxxx}, xxxx "three sheep watched in delight" digital words representing  

import itertools
for (a,b,c,d,e,f,g,h) in list( itertools.permutations( ['0','1','2','3','4','5','6','7','8','9'], 8 ) ):
if int( e+d+f+g ) + int( a+b+c+d ) == int( a+b+f+d+h ):
print ('result: ',a,b,c,d)

Guess you like

Origin www.cnblogs.com/DennyT/p/11331302.html