結城浩です。
以下に示すのは、令和6年度(2024年)栄東中学校入学試験問題 東大特待I(1月12日)〔算数〕の問題の大問4です。
結城浩『数学ガール』から出題されているため、 受験問題集を出版している「声の教育社」さんから掲載許諾の連絡をいただき、
こんにちは、knewjadeです。 今回、HATETIRSで289 linesまで到達することができました。動画はこちら(2022-11-26時点のWorld Recordでした。現在では更新されています。 → David&Felipeの記事)
ここでは、その結果を得るためのアプローチを説明していきたいと思います。
「そもそもHATETRISとは?」という方は、こちらをご参照ください。
; source https://github.com/woodrush/sectorlisp-examples/blob/main/lisp/basic.lisp | |
; Common Lisp translation: joswig@lisp.de, 2022 | |
; https://gist.github.com/lispm/a2f56a1a6dc5599a039eb7134d99cd4a | |
(defun basic-example () | |
(BASICINTERPRETER | |
(QUOTE ( | |
(10 REM FIND AND PRINT PRIME NUMBERS BELOW N_MAX. ) | |
(20 LET N_MAX = (1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) ) | |
(30 LET I = (1 1) ) |
type token = T_w | T_W | T_v | EOF;; | |
let rec scan s i = ( | |
let length = String.length s in | |
if i >= length then length, EOF else | |
match s.[i] with | |
| 'W' -> i + 1, T_W | |
| 'w' -> i + 1, T_w | |
| 'v' -> i + 1, T_v | |
| '\xef' -> (* W : EF BC B7, v : EF BD 96, w : EF BD 97 *) |
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |