結果

問題 No.188 HAPPY DAY
ユーザー MOD9cXWdOsRxvPy
提出日時 2022-09-18 18:59:22
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 499 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 6,692 KB
実行使用メモリ 17,024 KB
最終ジャッジ日時 2024-12-22 01:36:05
合計ジャッジ時間 969 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

(define eoml '(31 28 31 30 31 30 31 31 30 31 30 31))
(define ds (iota 31 1))

(define (sum-digit x)
  (if (< x 10)
      x
      (+ (div x 10) (mod x 10))))

(define sdodl (map (^ (x) (sum-digit x)) ds))

(define (days-of-month i)
  (car (drop eoml i)))

(define (sdod i)
  (take sdodl (days-of-month i)))

(define (count-hds i)
  (length
   (filter (^ (x) (= x (+ i 1))) (sdod i))))

(let loop ([i 0] [s 0])
  (if (= i 12)
      (format #t "~d~%" s)
      (loop (+ i 1)
	    (+ s (count-hds i)))))
0