結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2019-01-27 15:45:00 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 515 bytes |
コンパイル時間 | 127 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-09-24 17:42:42 |
合計ジャッジ時間 | 3,958 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 9 |
コンパイルメッセージ
Syntax OK
ソースコード
strs = gets.chomp.scan(/c.*w.*w/) if strs.length == 0 puts "-1" else c,w1,w2 = false, false, false count = 0 strs[0].chars do |s| count += 1 if s == "c" and c count = 1 w1 = false w2 = false elsif s == "c" c = true elsif s == "w" and not w1 w1 = true elsif s == "w" and w1 w2 = true end if c and w1 and w2 puts count break end end end