結果

問題 No.39 桁の数字を入れ替え
ユーザー kyo1kyo1
提出日時 2020-06-12 12:35:36
言語 Ruby
(3.3.0)
結果
AC  
実行時間 82 ms / 5,000 ms
コード長 212 bytes
コンパイル時間 462 ms
コンパイル使用メモリ 11,380 KB
実行使用メモリ 15,380 KB
最終ジャッジ日時 2023-09-06 09:03:58
合計ジャッジ時間 3,221 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,380 KB
testcase_01 AC 80 ms
15,232 KB
testcase_02 AC 79 ms
15,300 KB
testcase_03 AC 81 ms
15,232 KB
testcase_04 AC 79 ms
15,036 KB
testcase_05 AC 79 ms
15,120 KB
testcase_06 AC 79 ms
15,332 KB
testcase_07 AC 80 ms
15,072 KB
testcase_08 AC 81 ms
15,084 KB
testcase_09 AC 81 ms
15,208 KB
testcase_10 AC 80 ms
15,176 KB
testcase_11 AC 81 ms
15,108 KB
testcase_12 AC 81 ms
15,128 KB
testcase_13 AC 81 ms
15,136 KB
testcase_14 AC 82 ms
15,340 KB
testcase_15 AC 80 ms
15,176 KB
testcase_16 AC 81 ms
15,148 KB
testcase_17 AC 82 ms
15,228 KB
testcase_18 AC 82 ms
15,244 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require "set"

S = gets.chomp.chars

st = Set.new

S.size.times do |i|
  i.upto(S.size - 1) do |j|
    n = Marshal.load(Marshal.dump(S))
    n[i], n[j] = n[j], n[i]
    st.add(n.join.to_i)
  end
end

puts st.max
0