Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- L := FileOpen("day10_input.txt","R").Read()
- Sort, L, N
- List := StrSplit(L,"`r`n")
- List.insertAt(1,0)
- total := Pointer := 1
- Loop {
- if (Pointer >= List.Length())
- break
- count := CountConsecutive(List,Pointer)
- total *= GetMultiplier(count-1)
- Pointer += count + 1
- }
- Msgbox % total
- CountConsecutive(List,index) {
- Loop {
- if (List[index + A_Index] != List[index + A_Index - 1] + 1)
- Return % A_Index - 1
- }
- Return 1
- }
- GetMultiplier(n) {
- return n<1?1:n+GetMultiplier(n-1)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement