Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List := StrSplit(FileOpen("day9_input.txt","R").Read(),"`r`n")
- preamble := 25
- Loop % List.Length() {
- if (A_Index <= preamble)
- continue
- if !GetValidSum(List,A_Index,preamble)
- MsgBox % "Line: " A_Index "`nNumber: " List[A_Index]
- }
- GetValidSum(array,line,preamble) {
- Loop % preamble {
- Loop1_Index := A_Index
- Loop % preamble {
- if (Loop1_Index == A_Index)
- continue
- if (array[line - preamble - 1 + A_Index] + array[line - preamble - 1 + Loop1_Index] == array[line])
- return true
- }
- }
- return false
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement