oh duh, simplification
This commit is contained in:
parent
93ca6ada77
commit
33cde85eba
1 changed files with 2 additions and 10 deletions
12
05/05.py
12
05/05.py
|
@ -1,20 +1,12 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import re
|
|
||||||
|
|
||||||
maxid = 0
|
maxid = 0
|
||||||
ids = {}
|
ids = {}
|
||||||
for line in sys.stdin:
|
for line in sys.stdin:
|
||||||
rows = line[:7]
|
line = line.replace('F', '0').replace('B', '1').replace('R', '1').replace('L', '0')
|
||||||
seat = line[7:]
|
seatid = int(line, 2)
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
ids[seatid] = 1
|
ids[seatid] = 1
|
||||||
if maxid < seatid:
|
if maxid < seatid:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue