結果
| 問題 |
No.39 桁の数字を入れ替え
|
| コンテスト | |
| ユーザー |
tanukidon
|
| 提出日時 | 2018-03-24 11:23:01 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 242 bytes |
| コンパイル時間 | 192 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-06-25 02:44:40 |
| 合計ジャッジ時間 | 2,636 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 8 |
コンパイルメッセージ
Main.rb:9: warning: possibly useless use of != in void context Syntax OK
ソースコード
n = gets.chomp.split("").map(&:to_i)
a = n
b = 0
c = 0
m = 0
n.size.times do |i|
if n[0] == n.max
n.drop(0)
else n[0] !=n.max
m = n.rindex(n.max)
c = i
b += 1
break
end
end
a[m],a[c] =a[c],a[m] if b == 1
puts a.join
tanukidon