結果

問題 No.36 素数が嫌い!
ユーザー zazaboonzazaboon
提出日時 2017-01-23 17:36:20
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,554 ms / 5,000 ms
コード長 277 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 11,408 KB
実行使用メモリ 15,308 KB
最終ジャッジ日時 2023-09-09 07:47:21
合計ジャッジ時間 18,649 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 830 ms
15,104 KB
testcase_01 AC 909 ms
15,096 KB
testcase_02 AC 82 ms
15,076 KB
testcase_03 AC 83 ms
14,988 KB
testcase_04 AC 82 ms
15,148 KB
testcase_05 AC 86 ms
15,248 KB
testcase_06 AC 88 ms
15,248 KB
testcase_07 AC 88 ms
15,220 KB
testcase_08 AC 84 ms
15,060 KB
testcase_09 AC 86 ms
15,120 KB
testcase_10 AC 84 ms
15,144 KB
testcase_11 AC 386 ms
15,124 KB
testcase_12 AC 1,018 ms
15,200 KB
testcase_13 AC 1,019 ms
15,108 KB
testcase_14 AC 672 ms
15,308 KB
testcase_15 AC 82 ms
15,044 KB
testcase_16 AC 81 ms
15,144 KB
testcase_17 AC 82 ms
15,028 KB
testcase_18 AC 82 ms
15,236 KB
testcase_19 AC 703 ms
15,244 KB
testcase_20 AC 1,554 ms
15,028 KB
testcase_21 AC 1,323 ms
15,200 KB
testcase_22 AC 935 ms
15,300 KB
testcase_23 AC 647 ms
15,060 KB
testcase_24 AC 721 ms
15,108 KB
testcase_25 AC 848 ms
15,288 KB
testcase_26 AC 978 ms
15,196 KB
testcase_27 AC 902 ms
15,212 KB
testcase_28 AC 967 ms
15,124 KB
testcase_29 AC 991 ms
15,056 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)
if(c.size < 2)
  puts "NO"
  exit
end
j = divisor_list2(c[-2])
puts (j.size>2)? "YES" : "NO"
0