Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv
- SetBatchLines, -1
- SetWorkingDir, %A_ScriptDir%
- FileRead, read_file, Input.txt
- seats := StrSplit(read_file, "`r`n")
- SeatIds := []
- For each, seat in seats
- {
- row := 0
- For i, char in StrSplit(SubStr(seat, 1, 7))
- {
- row += (2**(7-i)) * (char == "F" ? 0 : 1)
- }
- column := 0
- For i, char in StrSplit(SubStr(seat, 8))
- {
- column += (2**(3-i)) * (char == "L" ? 0 : 1)
- }
- SeatIds[row * 8 + column] := 1
- }
- result := 0
- Loop, % SeatIds.MaxIndex()
- {
- If (A_Index > SeatIds.MinIndex())
- {
- If (SeatIds[A_Index] != 1)
- {
- result := A_Index
- Break
- }
- }
- }
- Clipboard := result
- MsgBox, % result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement