結果

問題 No.36 素数が嫌い!
ユーザー MiyamonYMiyamonY
提出日時 2019-09-05 15:55:40
言語 Scheme
(Gauche-0.9.14)
結果
WA  
実行時間 -
コード長 524 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 5,356 KB
実行使用メモリ 22,612 KB
最終ジャッジ日時 2023-09-02 11:10:21
合計ジャッジ時間 6,479 ms
ジャッジサーバーID
(参考情報)
judge14 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
22,316 KB
testcase_01 WA -
testcase_02 AC 103 ms
22,608 KB
testcase_03 AC 103 ms
22,280 KB
testcase_04 AC 103 ms
22,392 KB
testcase_05 AC 102 ms
22,300 KB
testcase_06 AC 103 ms
22,340 KB
testcase_07 AC 103 ms
22,284 KB
testcase_08 WA -
testcase_09 AC 102 ms
22,344 KB
testcase_10 WA -
testcase_11 AC 103 ms
22,344 KB
testcase_12 AC 103 ms
22,428 KB
testcase_13 AC 103 ms
22,612 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 103 ms
22,312 KB
testcase_17 AC 103 ms
22,340 KB
testcase_18 AC 102 ms
22,456 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 103 ms
22,388 KB
testcase_27 AC 103 ms
22,464 KB
testcase_28 AC 103 ms
22,320 KB
testcase_29 AC 102 ms
22,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(use math.prime)

(let* ((n (read)))
  (let1 result
	(let loop ((n n)
		   (primes *primes*))
	  (let1 prime (car primes)
		(cond ((= n 1) #f)
		      ((< n prime) #f)
		      (else
		       (let-values (((m divider)
				     (let loop ((n n)
						(m 0)
						(divider 1))
				       (if (and (= (mod n prime) 0) (< m 2))
					   (loop (div n prime) (+ m 1) (* prime divider))
					   (values m divider)))))
			 (if (> m 1)
			     (not (= n divider))
			     (loop m (cdr primes))))))))

	(print (if result "YES" "NO"))))
0