Guest User

Untitled

a guest
Dec 9th, 2020
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SetWorkingDir %A_ScriptDir%
  2.  
  3. FileRead, numStr, % A_ScriptDir "\d9.txt"
  4.  
  5. length := 25
  6.  
  7. numA := StrSplit(numStr, "`r`n")
  8. numAR := {}
  9. for i, j in numA {
  10.     if !numAR[j]
  11.         numAR[j] := {}
  12.     numAR[j][i] := 1
  13. }
  14.  
  15. for i, j in numA {
  16.     if (i < length + 1)
  17.         Continue
  18.     count := 0
  19.     ind := 0
  20.  
  21.     CurrentValue := j
  22.     Loop, % length
  23.     {
  24.         ind += 1
  25.         CheckedIndex := i - ind
  26.         CheckedValue1 := numA[CheckedIndex]
  27.         CheckedValue2 := CurrentValue - CheckedValue1
  28.         if numAR[CheckedValue2] and (CheckedValue1 != CurrentValue / 2) {
  29.             for k, l in numAR[CheckedValue2] {
  30.                 if (k < i) and (k > i - length){
  31.                     count += 1
  32.                 }
  33.             }
  34.         }
  35.     }
  36.     if (count = 0) {
  37.         invalid := j
  38.         Break
  39.     }
  40. }
  41.  
  42. for i, j in numA {
  43.     sum := 0
  44.     small=
  45.     big=
  46.     Loop
  47.     {
  48.         sum += numA[i + A_Index - 1]
  49.         if (numA[i + A_Index - 1] < small) or !small
  50.             small := numA[i + A_Index - 1]
  51.         if (numA[i + A_Index - 1] > big) or !big
  52.             big := numA[i + A_Index - 1]
  53.         if (sum >= invalid) {
  54.             last := numA[i + A_Index - 1]
  55.             Break
  56.         }
  57.     }
  58.     if (sum = invalid) {
  59.         Clipboard := small + big
  60.         Break
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment