結果

問題 No.36 素数が嫌い!
ユーザー zazaboonzazaboon
提出日時 2017-01-23 17:34:32
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 239 bytes
コンパイル時間 490 ms
コンパイル使用メモリ 11,552 KB
実行使用メモリ 15,532 KB
最終ジャッジ日時 2023-08-24 21:35:31
合計ジャッジ時間 20,123 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 833 ms
15,076 KB
testcase_01 AC 901 ms
15,316 KB
testcase_02 AC 78 ms
15,260 KB
testcase_03 AC 78 ms
15,256 KB
testcase_04 AC 78 ms
15,296 KB
testcase_05 AC 83 ms
15,120 KB
testcase_06 AC 81 ms
15,120 KB
testcase_07 AC 81 ms
15,256 KB
testcase_08 AC 80 ms
15,116 KB
testcase_09 AC 83 ms
15,172 KB
testcase_10 AC 81 ms
15,076 KB
testcase_11 AC 382 ms
15,108 KB
testcase_12 AC 1,017 ms
15,252 KB
testcase_13 AC 1,013 ms
15,140 KB
testcase_14 AC 673 ms
15,040 KB
testcase_15 AC 78 ms
15,140 KB
testcase_16 AC 77 ms
15,232 KB
testcase_17 RE -
testcase_18 AC 79 ms
15,080 KB
testcase_19 AC 701 ms
15,248 KB
testcase_20 AC 1,549 ms
15,256 KB
testcase_21 AC 1,309 ms
15,040 KB
testcase_22 AC 936 ms
15,264 KB
testcase_23 AC 645 ms
15,320 KB
testcase_24 AC 718 ms
15,268 KB
testcase_25 AC 841 ms
15,296 KB
testcase_26 AC 975 ms
15,108 KB
testcase_27 AC 898 ms
15,112 KB
testcase_28 AC 954 ms
15,072 KB
testcase_29 AC 989 ms
15,248 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:2: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument
Syntax OK

ソースコード

diff #

a = gets.chomp.to_i
def divisor_list2 (a)
  return [1] if a == 1
  (1..Math.sqrt(a).to_i).select do |i|
    a%i == 0
  end.map {|e| [e, a/e]}.flatten.uniq.sort
end
c = divisor_list2(a)
j = divisor_list2(c[-2])
puts (j.size>2)? "YES" : "NO"
0