Advertisement
Korotkodul

dem23.n8

Jun 9th, 2023
644
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. n = 3 * 7**3 + 2*3* 7**2 + 6* 3**2 *7 + 6*7 * 3**2 + 6 * 7**2 * 3
  2. #print(n)
  3. #2961
  4. ok = set()
  5. v = list(range(8))
  6. for a1 in v:
  7.     for a2 in v:
  8.         for a3 in v:
  9.             for a4 in v:
  10.                 for a5 in v:
  11.                     s = str(a1) + str(a2) + str(a3) + str(a4) + str(a5)
  12.                     if s[0] == '0':
  13.                         continue
  14.                     if s.count('6') != 1:
  15.                         continue
  16.                     if s[0] == '6' and int(s[1]) % 2 == 1:
  17.                         continue
  18.                     if s[-1] == '6' and int(s[-2]) % 2 == 1:
  19.                         continue
  20.                     if s[0] == '6':
  21.                         ok.add(s)
  22.                         continue
  23.                     if s[-1] == '6':
  24.                         ok.add(s)
  25.                         continue
  26.                     i = s.find('6')
  27.                     if int(s[i-1]) % 2 == 1 or int(s[i+1]) % 2==1:
  28.                         continue
  29.                     ok.add(s)
  30. print(len(ok))
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement