結果

問題 No.36 素数が嫌い!
ユーザー MiyamonYMiyamonY
提出日時 2019-09-06 19:21:03
言語 Scheme
(Gauche-0.9.14)
結果
WA  
実行時間 -
コード長 398 bytes
コンパイル時間 46 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 24,692 KB
最終ジャッジ日時 2023-09-06 14:54:37
合計ジャッジ時間 4,044 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
22,712 KB
testcase_01 AC 89 ms
22,632 KB
testcase_02 AC 94 ms
22,736 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 84 ms
22,628 KB
testcase_08 AC 85 ms
22,624 KB
testcase_09 AC 83 ms
22,752 KB
testcase_10 AC 88 ms
22,620 KB
testcase_11 AC 87 ms
22,760 KB
testcase_12 AC 84 ms
22,688 KB
testcase_13 WA -
testcase_14 AC 92 ms
22,688 KB
testcase_15 AC 86 ms
22,692 KB
testcase_16 AC 85 ms
22,712 KB
testcase_17 AC 86 ms
22,896 KB
testcase_18 AC 82 ms
22,892 KB
testcase_19 AC 84 ms
22,668 KB
testcase_20 AC 90 ms
22,816 KB
testcase_21 AC 88 ms
22,728 KB
testcase_22 AC 91 ms
22,816 KB
testcase_23 AC 87 ms
22,880 KB
testcase_24 AC 88 ms
22,532 KB
testcase_25 AC 83 ms
22,724 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

(use math.prime)

(let* ((n (read)))
  (when (small-prime? n)
    (print "NO")
    (exit 0))

  (let1 m
	(let loop ((primes *primes*)
		   (m n)
		   (num 0))
	  (let1 prime #?=(car primes)
		(cond  ((< m prime) num)
		       ((< 3 m) m)
		       (else
			(if (= (mod m prime) 0)
			    (loop primes (div m prime) (+ num 1))
			    (loop (cdr primes) m num))))))
	(print (if (> m 2) "YES" "NO"))))
0