結果
| 問題 | No.345 最小チワワ問題 |
| コンテスト | |
| ユーザー |
harhogefoo
|
| 提出日時 | 2016-10-14 09:35:47 |
| 言語 | Ruby (4.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 257 bytes |
| 記録 | |
| コンパイル時間 | 89 ms |
| コンパイル使用メモリ | 8,960 KB |
| 実行使用メモリ | 15,104 KB |
| 最終ジャッジ日時 | 2026-05-16 09:20:45 |
| 合計ジャッジ時間 | 3,237 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 14 |
コンパイルメッセージ
Main.rb:17: warning: ambiguous first argument; put parentheses or a space even after `-` operator Syntax OK
ソースコード
s = gets.chomp
count = 0
is_c = false
w_count = 0
s.each_char do |c|
is_c = true if c == 'c'
w_count += 1 if is_c and c == 'w'
if is_c and w_count <= 2
count += 1
end
break if w_count == 2
end
if w_count != 2
puts -1
else
puts count
end
harhogefoo