結果

問題 No.559 swapAB列
ユーザー maimai
提出日時 2017-08-25 22:23:23
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 190 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-04-23 15:29:49
合計ジャッジ時間 1,729 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 95 ms
12,288 KB
testcase_02 RE -
testcase_03 AC 90 ms
12,032 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 88 ms
12,160 KB
testcase_09 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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