結果
| 問題 | No.559 swapAB列 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-08-25 22:25:03 |
| 言語 | Ruby (4.0.2) |
| 結果 |
AC
|
| 実行時間 | 54 ms / 2,000 ms |
| コード長 | 252 bytes |
| 記録 | |
| コンパイル時間 | 84 ms |
| コンパイル使用メモリ | 8,960 KB |
| 実行使用メモリ | 14,976 KB |
| 最終ジャッジ日時 | 2026-05-04 23:26:01 |
| 合計ジャッジ時間 | 1,355 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
コンパイルメッセージ
Syntax OK
ソースコード
def ascan; gets.split.map(&:to_i);end
str = gets.chomp
n = str.size
r = 0
while str.chars.sort != str.chars
1.upto(n-1){|i|
if str[i-1]>str[i]
r += 1
str[i-1],str[i] = str[i],str[i-1]
end
}
end
p r