Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def to(x, bs):
- r=[]
- st=x
- #print("GO")
- while x > 0:
- r.append(x%bs)
- x//=bs
- r=r[::-1]
- while len(r) < 4:
- #print("l=",len(r))
- #r = [*z, *r]
- #r = r[::-1]
- #r.append(0)
- #r = r[::-1]
- r = [0] + r
- print(st,r)
- return r
- def f(x):
- print(x[0] or x[1] and x[2],x[1] or x[2] and x[3],x[2] or x[3] or x[0])
- print((x[0] or x[1] and x[2]) and (x[1] or x[2] and x[3] ) and (x[2] or x[3] or x[0]))
- return (x[0] or (x[1] and x[2])) and (x[1] or (x[2] and x[3] )) and (x[2] or x[3] or x[0])
- num = []
- for i in range(16):
- num.append(i)
- num=num[::-1]
- Bnum = []
- print(num)
- #print(len(num))
- for i in range(16):
- Bnum.append(f(to(num[i],2)))
- print(Bnum)
- zer=0
- one=0
- for i in range(16):
- if f(to(i,2)) == True:
- one+=1
- else:
- zer += 1
- print("zer one")
- print(zer, one)
- Bzer = Bnum.count(0)
- Bone = Bnum.count(1)
- print(Bzer, Bone)
- res = zer ** Bzer * one ** Bone
- res = str(res)
- ans=0
- for i in res:
- ans += int(i)
- print(res)
- print("ans=",ans)
Add Comment
Please, Sign In to add comment