Created
October 9, 2017 15:53
-
-
Save evjeny/c6112dbb17b2991b5d03dbce9a42c583 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gip(msk,adrs): | |
ma = [int(i) for i in msk.split(".")] | |
da = [int(i) for i in adrs.split(".")] | |
res = "" | |
for j in range(4): | |
c = ma[j]&da[j] | |
if j!=3: | |
res += str(c) + "." | |
else: | |
res += str(c) | |
return res | |
a = input() | |
n = int(input()) | |
k = [] | |
for i in range(n): | |
c = input() | |
k.append(gip(a,c)) | |
d = set(k) | |
print(len(d)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment