結果

問題 No.559 swapAB列
ユーザー mai
提出日時 2017-08-25 22:23:23
言語 Ruby
(3.4.1)
結果
RE  
実行時間 -
コード長 190 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-10-15 15:54:01
合計ジャッジ時間 1,652 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 RE * 2
other AC * 2 RE * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def ascan; gets.split.map(&:to_i);end


str = gets.chomp

n = str.size

r = 0
1.upto(n-1){|i|
    if str[i-1]>str[i]
        r += 1
        str[i-1],str[i] = str[i]>str[i-1]
    end
}

p r

0