fork download
  1. def to2(n: int): return bin(n)[2:]
  2.  
  3.  
  4. def alg(ord):
  5. res = 1
  6. for i in ord: res += 4 if i == "0" else -3
  7. return res
  8.  
  9.  
  10. s = set()
  11. for n in range(0, 128): s.add(alg(to2(n)))
  12. ans = len(s)
  13. print(ans)
Success #stdin #stdout 0.02s 9264KB
stdin
Standard input is empty
stdout
29