結果

問題 No.211 素数サイコロと合成数サイコロ (1)
ユーザー Rin
提出日時 2015-09-04 17:07:23
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 28 ms / 1,000 ms
コード長 728 bytes
コンパイル時間 34 ms
コンパイル使用メモリ 6,692 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2024-06-25 22:35:47
合計ジャッジ時間 2,328 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (System.out.println x)
  (begin
    (display x)
    (newline)
  )
)

(define foo
  (let loop(
            (i 0)
            (j 0)
            (prime (list 2 3 5 7 11 13))
            (comp  (list 4 6 8 9 10 12))
            (ls '())
           )
    (if (= i 6)
        ls
        (loop (+ i (floor (/ j 5))) (modulo (+ j 1) 6) prime comp (cons (* (list-ref prime i) (list-ref comp j)) ls))
    )
  )
)

(define (CntCase x)
  (let loop(
            (i 0)
            (Matched 0)
           )
    (if (= i 36)
        Matched
        (if (= x (list-ref foo i))
            (loop (+ i 1) (+ Matched 1))
            (loop (+ i 1) Matched)
        )
    )
  )
)

(System.out.println (exact->inexact (/ (CntCase (read)) 36)))
0