Advertisement
nq1s788

5 (с функцией двоичная)

Jan 13th, 2024
1,373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. def f(n):
  2.     s = bin(n)[2:]
  3.     if s.count('1') % 2 == 0:
  4.         s += '00'
  5.     else:
  6.         s += '11'
  7.     return int(s, 2)
  8.  
  9.  
  10. answ = 1000000
  11. for n in range(1000000):
  12.     if f(n) > 114:
  13.         answ = min(answ, f(n))
  14. print(answ)
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement