結果
| 問題 |
No.8030 ミラー・ラビン素数判定法のテスト
|
| ユーザー |
norioc
|
| 提出日時 | 2025-06-22 15:04:16 |
| 言語 | Scheme (Gauche-0.9.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 890 bytes |
| コンパイル時間 | 282 ms |
| コンパイル使用メモリ | 8,352 KB |
| 実行使用メモリ | 33,824 KB |
| 最終ジャッジ日時 | 2025-06-22 15:04:38 |
| 合計ジャッジ時間 | 21,884 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 WA * 1 |
ソースコード
(use scheme.list)
(use util.match)
(use srfi.13) ; string
(use srfi.42) ; list-ec
(define input read-line)
(define (ii)
(string->number (read-line)))
(define (li)
(let ((s (read-line)))
(map string->number (string-split s " "))))
(define (prn . args)
(for-each (lambda (i x)
(when (> i 0)
(display " "))
(display x))
(iota (length args))
args)
(newline))
(define int string->number)
(define (minmax* xs) (apply min&max xs))
(define (sum . xs) (apply + xs))
(define (sum* xs) (apply + xs))
(define divmod div-and-mod)
(use math.prime)
(define (prime? n)
(cond
((< n *small-prime-bound*)
(small-prime? n))
(else
(and (> n 1) (miller-rabin-prime? n :num-tests 12)))))
(let* ((n (ii)))
(dotimes (_ n)
(let ((x (ii)))
(if (prime? x)
(prn x 1)
(prn x 0)))))
norioc