diff --git a/05/05.py b/05/05.py index f15c3d7..d1eb09e 100644 --- a/05/05.py +++ b/05/05.py @@ -6,23 +6,20 @@ import re maxid = 0 ids = {} for line in sys.stdin: - rows = line[0:7] - seat = line[7:10] + rows = line[:7] + seat = line[7:] - rows = rows.replace('F', '0') - rows = rows.replace('B', '1') - seat = seat.replace('R', '1') - seat = seat.replace('L', '0') + rows = rows.replace('F', '0').replace('B', '1') + seat = seat.replace('R', '1').replace('L', '0') row = int(rows, 2) column = int(seat, 2) - seatid = row*8+column - #print(row, column, seatid) + seatid = row * 8 + column + ids[seatid] = 1 if maxid < seatid: maxid = seatid - print(1, maxid) seen = 0