結果
| 問題 |
No.559 swapAB列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-08-25 22:25:03 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 88 ms / 2,000 ms |
| コード長 | 252 bytes |
| コンパイル時間 | 481 ms |
| コンパイル使用メモリ | 7,168 KB |
| 実行使用メモリ | 12,032 KB |
| 最終ジャッジ日時 | 2024-10-15 15:56:47 |
| 合計ジャッジ時間 | 1,601 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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