summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--1.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/1.hs b/1.hs
new file mode 100644
index 0000000..39893d0
--- /dev/null
+++ b/1.hs
@@ -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)))))))
+