Advertisement
mirovlad

The Song of the Wheels 3

Jun 12th, 2022
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. m = int(input())    # 4 - 144
  2. list_num = []
  3. # pass format: abcd
  4. # m = a*b + c*d
  5. # a < b
  6. # c > d
  7. # a, b, c, d (1 - 9)
  8. # Търсим 4-тото число !!!!
  9. check_find = False
  10. password = False
  11. for i in range(1, 10):
  12.     for j in range(1, 10):
  13.         for k in range(1, 10):
  14.             for l in range(1, 10):
  15.                 if m == i * j + k * l and j > i and k > l:
  16.                     list_num.append(str(i) + str(j) + str(k) + str(l))
  17.                     check_find = True
  18. if len(list_num) >= 4:
  19.     password = True
  20.  
  21. # if check_find:
  22.  
  23. if len(list_num) > 0:
  24.     for numbers in list_num:
  25.         print(numbers, end=' ')
  26.     print()
  27.  
  28. if password:
  29.     print(f'Password: {list_num[3]}')
  30.  
  31. if not password:
  32.     print('No!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement