blob: 9b3ace686e8cfd20d0b087f12635ea38f23c8daf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
;;; https://gitlab.com/Syndamia/senzill
(require :senzill)
(use-package :senzill.math)
(use-package :senzill.collections)
(use-package :senzill.io)
(ask-for-stream (prog-input)
(let ((X 1) (cycles 1) (check-on 20) (check-max 220) (signal-sum 0))
(doread-lines (inpt :read-line-options (prog-input NIL))
(loop for i from 1 to (if (char= (char inpt 0) #\a) 2 1)
if (and (> check-on 0) (= cycles check-on))
do (+= signal-sum (* X check-on))
(if (< check-on check-max)
(+= check-on 40)
(setf check-on -1))
if (= i 2)
do (+= X (parse-integer inpt :start 5))
do (++1 cycles)))
(print signal-sum)))
|