Last active
September 28, 2016 02:40
-
-
Save trueskawka/ba9f5dae3fd89a30b30a353b30ffee74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Html exposing (text) | |
import Set | |
import List | |
main = | |
-- text (toString (List.sum (pairs [1, 5, 3, 4, 2] 2))) | |
text (toString (List.sum (pairs [363374326, 364147530, 61825163, 1073065718, 1281246024, | |
1399469912, 428047635, 491595254, 879792181, 1069262793] | |
1))) | |
check i k b counter = | |
let | |
lower = i - k | |
in | |
if Set.member lower b then | |
counter + 1 | |
else | |
counter | |
pairs a k = | |
let | |
answer = 0 | |
b = Set.fromList a | |
in | |
List.map (\ i -> check i k b answer) a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment