25 lines
563 B
Python
25 lines
563 B
Python
lines = (x.strip() for x in open("input.txt"))
|
|
|
|
reserved = []
|
|
|
|
|
|
def parse_binary_string(string: str, ones):
|
|
length = len(string) - 1
|
|
cnt = 0
|
|
for idx, val in enumerate(string):
|
|
cnt += 2 ** (length-idx) if val == ones else 0
|
|
return cnt
|
|
|
|
|
|
for line in lines:
|
|
row = parse_binary_string(line[:7], ones="B")
|
|
col = parse_binary_string(line[7:], ones="R")
|
|
num = row * 8 + col
|
|
reserved.append(num)
|
|
|
|
reserved = sorted(reserved)
|
|
|
|
for i in range(len(reserved) - 1):
|
|
if reserved[i+1] - reserved[i] == 2:
|
|
print(reserved[i]+1)
|