diff options
| author | nikolas <nikolas@boutalas.com> | 2025-12-02 12:03:55 +0200 |
|---|---|---|
| committer | nikolas <nikolas@boutalas.com> | 2025-12-03 01:29:24 +0200 |
| commit | 05af31c14d2ae7379db54c981505562cc6f569d7 (patch) | |
| tree | b33ec0d269a60cddad484b21dfc844ba1dfe54c3 | |
day 1
| -rw-r--r-- | 1.hs | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -0,0 +1,11 @@ +parse ('L':n) = -(read n) +parse ('R':n) = read n + +clicks x = replicate (abs x) (signum x) + +isOnZero n = (n `mod` 100 == 0) || (n == 0) + +main = do + input <- getContents + print (length (filter isOnZero (scanl (+) 50 (concat (map (clicks) (map parse (lines input))))))) + |
