結果

問題 No.188 HAPPY DAY
ユーザー MOD9cXWdOsRxvPyMOD9cXWdOsRxvPy
提出日時 2022-09-18 18:59:22
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 25 ms / 1,000 ms
コード長 499 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 5,300 KB
実行使用メモリ 12,728 KB
最終ジャッジ日時 2023-08-23 18:17:13
合計ジャッジ時間 713 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
12,728 KB
権限があれば一括ダウンロードができます

ソースコード

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