結果

問題 No.345 最小チワワ問題
ユーザー finefine
提出日時 2016-03-04 17:31:15
言語 Ruby
(3.4.1)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 204 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-09-25 11:36:47
合計ジャッジ時間 4,205 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:13: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

s = gets.chomp
ans = 1000
while s != ''
    if s =~ /c(.*?w.*?w)/
        ans = [ans,$&.length].min
        s = $1 + $'.to_s
    else
        s = ''
    end
end

if ans == 1000
    p -1
else
    p ans
end
0