Sichanov

dd

Jul 21st, 2021
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. n = int(input())
  2. is_found = False
  3. abcd = ''
  4. for a in range(1, 10):
  5.     for b in range(9, a - 1, - 1):
  6.         for c in range(0, 10):
  7.             for d in range(9, c - 1, -1):
  8.                 if (a + b + c + d) == (a * b * c * d) and n % 10 == 5:
  9.                     print(f'{a}{b}{c}{d}')
  10.                     exit()
  11.                 elif (a * b * c * d) // (a + b + c + d) == 3 and n % 3 == 0:
  12.                     print(f'{d}{c}{b}{a}')
  13.                     exit()
  14. if abcd == '':
  15.     print('Nothing found')
  16.  
Advertisement
Add Comment
Please, Sign In to add comment