Stole Fichte’s parse idea
This commit is contained in:
parent
137e8c22e9
commit
a3d0bcde24
|
@ -1,16 +1,10 @@
|
||||||
import Data.List
|
import Data.List
|
||||||
|
|
||||||
main = do
|
main = do
|
||||||
print (day4a 130254 678275)
|
print (day4 p [130254..678275])
|
||||||
print (day4b 130254 678275)
|
print (day4 p' [130254..678275])
|
||||||
|
|
||||||
day4a bottom top = dumbbrute bottom top p 0
|
day4 p = sum . map (fromEnum . p . show)
|
||||||
day4b bottom top = dumbbrute bottom top p' 0
|
|
||||||
|
|
||||||
dumbbrute x y p acc
|
|
||||||
| x'<=y = dumbbrute x' y p (if p $ show x then acc+1 else acc)
|
|
||||||
| otherwise = acc
|
|
||||||
where x' = succ x
|
|
||||||
|
|
||||||
p x
|
p x
|
||||||
| sort x /= x = False
|
| sort x /= x = False
|
||||||
|
|
Loading…
Reference in New Issue
Block a user