結果

問題 No.774 tatyamと素数大富豪
ユーザー maimai
提出日時 2018-12-22 00:13:47
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 212 bytes
コンパイル時間 134 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 13,696 KB
最終ジャッジ日時 2024-09-25 09:47:40
合計ジャッジ時間 4,634 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4 WA * 1
other AC * 12 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:18: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Main.rb:3: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

require 'prime'

n = gets.to_i
a = gets.chomp.split

h = {}

a.sort.reverse.permutation do |perm|
    i = (perm*"").to_i
    next if h[i]
    h[i] = true
    if i.prime?
        p i
        exit
    end
end

p -1
0