結果
問題 |
No.36 素数が嫌い!
|
ユーザー |
![]() |
提出日時 | 2017-01-23 17:36:20 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 1,618 ms / 5,000 ms |
コード長 | 277 bytes |
コンパイル時間 | 121 ms |
コンパイル使用メモリ | 7,680 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-06-27 00:54:53 |
合計ジャッジ時間 | 19,457 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
コンパイルメッセージ
Main.rb:2: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument Syntax OK
ソースコード
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"