結果
問題 |
No.996 Phnom Penh
|
ユーザー |
|
提出日時 | 2020-02-21 23:24:43 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 536 bytes |
コンパイル時間 | 349 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 14,464 KB |
最終ジャッジ日時 | 2024-10-09 02:29:39 |
合計ジャッジ時間 | 3,734 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 WA * 21 |
コンパイルメッセージ
Syntax OK
ソースコード
s = STDIN.gets ans = 0 s.scan(/phn(?:om)+/).each do |t| ans += t.length - 3 end if s.include?("phnom") then s.gsub!(/phn(?:om)+/, "penh") s.gsub!(/h/, "") s.gsub!(/e/, "h") end if s.include?("h") then ans += 1; s.gsub!(/h/, "") s.gsub!(/e/, "h") end #p ans s.scan(/phn(?:om)+/).each do |t| ans += t.length - 3 end if s.include?("phnom") then s.gsub!(/phn(?:om)+/, "penh") s.gsub!(/h/, "") s.gsub!(/e/, "h") end if s.include?("h") then ans += 1; s.gsub!(/h/, "") s.gsub!(/e/, "h") end puts ans