結果

問題 No.36 素数が嫌い!
ユーザー kokoa1046kokoa1046
提出日時 2017-09-08 21:20:36
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 555 bytes
コンパイル時間 62 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-04-24 20:20:21
合計ジャッジ時間 8,521 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 339 ms
12,544 KB
testcase_01 AC 128 ms
12,416 KB
testcase_02 AC 109 ms
12,288 KB
testcase_03 WA -
testcase_04 AC 107 ms
12,288 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 108 ms
12,544 KB
testcase_08 AC 107 ms
12,288 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# Here your code !
require 'prime'
#p Prime.each.take(100).last
class Integer
  def divisor_list
    divisors = [1]
    primes = []
    Prime.prime_division(self).each do |prime|
      prime[1].times {primes << prime[0]}
    end

    1.upto(primes.size) do |i|
      primes.combination(i) do |prime|
        divisors << prime.inject{|a,b| a *= b}
      end
    end

    divisors.uniq!
    divisors.sort!
    return divisors
  rescue ZeroDivisionError
    return
  end
end

a=gets.to_i
if a.divisor_list.length>3 then
    puts "YES"
else
    puts "NO"
end
0