結果
問題 |
No.39 桁の数字を入れ替え
|
ユーザー |
|
提出日時 | 2016-10-28 20:37:13 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 88 ms / 5,000 ms |
コード長 | 204 bytes |
コンパイル時間 | 46 ms |
コンパイル使用メモリ | 7,680 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-10-02 07:14:02 |
合計ジャッジ時間 | 2,401 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
コンパイルメッセージ
Syntax OK
ソースコード
s = gets.chomp nmax = s.to_i m = s.length 0.upto(m-2) do |i| 1.upto(m-1) do |j| flipped = s.clone flipped[i] = s[j] flipped[j] = s[i] nmax = [nmax, flipped.to_i].max end end puts nmax