結果

問題 No.345 最小チワワ問題
ユーザー jiro8719jiro8719
提出日時 2018-07-10 13:03:03
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 225 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 11,540 KB
実行使用メモリ 15,348 KB
最終ジャッジ日時 2023-09-27 11:26:23
合計ジャッジ時間 4,384 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
15,144 KB
testcase_01 AC 82 ms
15,144 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 88 ms
15,168 KB
testcase_06 WA -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 83 ms
15,140 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 83 ms
15,196 KB
testcase_19 WA -
testcase_20 AC 86 ms
15,180 KB
testcase_21 AC 84 ms
15,088 KB
testcase_22 AC 85 ms
15,132 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 85 ms
15,160 KB
testcase_29 AC 84 ms
15,268 KB
testcase_30 WA -
testcase_31 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:17: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

input = gets.chomp
size = input.size
for i in 0..size-1
    if input[i] == "c"
        x = i
        next
    end
    if input[i] == "w"
        y = i
        next
    end
end

if x < y
    puts y - x + 1
else
    puts -1
end
0