repositories
/
aoc20.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
22
[aoc20.git]
/
1
/
one.icl
1
module one
2
3
import StdEnv
4
5
read :: *File -> [Int]
6
read f
7
# (ok, l, f) = freadi f
8
| not ok = []
9
= [l:read f]
10
11
Start w
12
# (io, w) = stdio w
13
# ls = read io
14
= (one ls, two ls)
15
16
one :: [Int] -> Int
17
one nums = hd [x*y\\x<-nums, y<-nums | x + y == 2020]
18
19
two :: [Int] -> Int
20
two nums = hd [x*y*z\\x<-nums, y<-nums, z<-nums | x + y + z == 2020]