結果

問題 No.1765 While Shining
ユーザー Merry-AmorMerry-Amor
提出日時 2021-12-03 20:38:26
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 752 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 11,248 KB
実行使用メモリ 59,272 KB
最終ジャッジ日時 2023-09-20 08:24:04
合計ジャッジ時間 6,120 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
15,040 KB
testcase_01 AC 83 ms
15,300 KB
testcase_02 AC 81 ms
15,124 KB
testcase_03 AC 81 ms
15,084 KB
testcase_04 AC 103 ms
15,344 KB
testcase_05 AC 152 ms
15,584 KB
testcase_06 AC 105 ms
15,424 KB
testcase_07 AC 102 ms
15,400 KB
testcase_08 AC 307 ms
16,456 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def reverseNumByArray stdAr
        returnAr = []
        stdAr.each{|num|
                case num
                when '0'
                        returnAr.push('1')
                when '1'
                        returnAr.push('0')
                end
        }
        return returnAr
end


inputN = gets
N = inputN.to_i

inputI = gets
I = inputI.split(' ')

ans = 0
place = 0

for i in 0..(N-1) do
        place = i
        cloneI = I.clone
        while (cloneI[place] != "0") do
                if place == (N - 1) then
                        break
                else
                        place += 1
                        ans += 1
                        cloneI = reverseNumByArray(cloneI)
                end
        end
end

puts ans
0