結果

問題 No.774 tatyamと素数大富豪
ユーザー maimai
提出日時 2018-12-22 00:13:47
言語 Ruby
(3.2.2)
結果
WA  
実行時間 -
コード長 212 bytes
コンパイル時間 599 ms
コンパイル使用メモリ 11,984 KB
実行使用メモリ 18,780 KB
最終ジャッジ日時 2023-10-26 01:40:43
合計ジャッジ時間 5,774 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
16,404 KB
testcase_01 AC 88 ms
16,404 KB
testcase_02 AC 452 ms
18,520 KB
testcase_03 AC 93 ms
16,408 KB
testcase_04 WA -
testcase_05 AC 91 ms
16,408 KB
testcase_06 AC 90 ms
16,408 KB
testcase_07 AC 91 ms
16,408 KB
testcase_08 AC 91 ms
16,408 KB
testcase_09 AC 478 ms
18,780 KB
testcase_10 AC 176 ms
18,520 KB
testcase_11 AC 94 ms
16,408 KB
testcase_12 WA -
testcase_13 AC 90 ms
16,408 KB
testcase_14 AC 133 ms
17,052 KB
testcase_15 AC 90 ms
16,408 KB
testcase_16 AC 462 ms
18,520 KB
testcase_17 WA -
testcase_18 AC 90 ms
16,600 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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