結果

問題 No.36 素数が嫌い!
ユーザー KisaragiEffectiveKisaragiEffective
提出日時 2020-11-11 20:07:01
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,050 ms / 5,000 ms
コード長 209 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 11,428 KB
実行使用メモリ 15,548 KB
最終ジャッジ日時 2023-09-30 00:52:34
合計ジャッジ時間 18,323 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 736 ms
15,380 KB
testcase_01 AC 839 ms
15,456 KB
testcase_02 AC 87 ms
15,148 KB
testcase_03 AC 87 ms
15,432 KB
testcase_04 AC 87 ms
15,376 KB
testcase_05 AC 93 ms
15,512 KB
testcase_06 AC 90 ms
15,328 KB
testcase_07 AC 90 ms
15,248 KB
testcase_08 AC 88 ms
15,148 KB
testcase_09 AC 89 ms
15,396 KB
testcase_10 AC 89 ms
15,140 KB
testcase_11 AC 396 ms
15,128 KB
testcase_12 AC 1,034 ms
15,436 KB
testcase_13 AC 1,035 ms
15,168 KB
testcase_14 AC 681 ms
15,360 KB
testcase_15 AC 89 ms
15,232 KB
testcase_16 AC 87 ms
15,520 KB
testcase_17 AC 86 ms
15,248 KB
testcase_18 AC 87 ms
15,212 KB
testcase_19 AC 489 ms
15,536 KB
testcase_20 AC 1,050 ms
15,336 KB
testcase_21 AC 921 ms
15,548 KB
testcase_22 AC 844 ms
15,284 KB
testcase_23 AC 537 ms
15,504 KB
testcase_24 AC 717 ms
15,412 KB
testcase_25 AC 734 ms
15,436 KB
testcase_26 AC 975 ms
15,404 KB
testcase_27 AC 904 ms
15,280 KB
testcase_28 AC 962 ms
15,508 KB
testcase_29 AC 999 ms
15,520 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'
v=gets.to_i
# 存在するか?
EXISTS=(1..Math.sqrt(v).floor).select{|n| v % n == 0}.map{|n| [n, v/ n]}.flatten.reject{|n| n == 1 || n == v || Prime.prime?(n)}.any?
puts EXISTS ? "YES" : "NO"
0