結果
問題 | No.996 Phnom Penh |
ユーザー |
|
提出日時 | 2020-02-21 23:51:03 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 212 ms / 2,000 ms |
コード長 | 511 bytes |
コンパイル時間 | 136 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 17,792 KB |
最終ジャッジ日時 | 2024-10-09 02:54:02 |
合計ジャッジ時間 | 4,336 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
コンパイルメッセージ
Syntax OK
ソースコード
$s = STDIN.gets $ans = 0 def f temp = 0 $s.scan(/phnom/).each do |t| temp += 1 end if $s.include?("phnom") then $s.gsub!(/phnom/, "penh") end if $s.include?("h") or $s.include?("e") then temp += 1 $s.gsub!(/h/, "") $s.gsub!(/e/, "h") end # puts $s temp end $ans += f $ans += f $s.scan(/phn(?:om)+/).each do |t| $ans += t.length - 3 end if $s.include?("phnom") then $ans += 1 elsif $s.include?("h") or $s.include?("e")then $ans += 1 end puts $ans