結果

問題 No.927 Second Permutation
ユーザー gemmaro
提出日時 2019-11-26 08:47:57
言語 Ruby
(3.4.1)
結果
MLE  
実行時間 -
コード長 211 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 817,520 KB
最終ジャッジ日時 2024-11-06 07:27:03
合計ジャッジ時間 5,563 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 MLE * 1 -- * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:5: warning: assigned but unused variable - largest
Syntax OK

ソースコード

diff #

# frozen_string_literal: true

x = gets.chomp.chars.map(&:to_i).sort.permutation.to_a.uniq

largest = x[-1].map(&:to_s).join.to_i

if x.size < 2 || x[-2][0].zero?
  p(-1)
else
  p x[-2].map(&:to_s).join.to_i
end
0