Its cute how the c++ version of day 5 is shorter
This commit is contained in:
@@ -18,7 +18,9 @@ def from_binary(bsp):
|
||||
|
||||
return int(bsp.replace('F', '0').replace('L', '0').replace('B', '1').replace('R', '1'), 2)
|
||||
|
||||
def get_id(row, col): return row * 8 + col
|
||||
def get_id(row, col):
|
||||
# return row * 8 + col
|
||||
return row << 3 | col
|
||||
|
||||
def parse_seats(data):
|
||||
seats = []
|
||||
@@ -45,6 +47,3 @@ def solve_b(seats):
|
||||
seats = parse_seats(data)
|
||||
print(solve_a(seats))
|
||||
print(solve_b(seats))
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user