blob: ad82334380d5171864457ff476e545feea488e80 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
;;; -*- lexical-binding: t; -*-
(defun main (filename)
(with-temp-buffer
(insert-file-contents-literally filename)
(let* ((width 25)
(height 6)
(area (* width height))
(min-zeros most-positive-fixnum)
answer)
(while (not (eobp))
(let* ((end (+ (point) area))
(string (buffer-substring (point) end))
(zeros (seq-count (make-= ?0) string)))
(when (< zeros min-zeros)
(setq min-zeros zeros
answer (* (seq-count (make-= ?1) string)
(seq-count (make-= ?2) string))))
(goto-char end)))
answer)))
(defun make-= (x)
(lambda (y) (= x y)))
(message "%d" (main "input"))
|