Sichanov

sss

Apr 19th, 2021 (edited)
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. n = int(input())
  2. is_found = False
  3. for a in range(1, 10):
  4.     for b in range(9, a - 1, - 1):
  5.         for c in range(0, 10):
  6.             for d in range(9, c - 1, -1):
  7.                 if (a + b + c + d) == (a * b * c * d) and n % 10 == 5:
  8.                     is_found = True
  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 not is_found:
  15.     print('Nothing found')
  16.  
Add Comment
Please, Sign In to add comment