結果

問題 No.996 Phnom Penh
ユーザー HaarHaar
提出日時 2020-02-21 23:49:09
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 472 bytes
コンパイル時間 52 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-04-17 09:36:39
合計ジャッジ時間 3,753 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
12,160 KB
testcase_01 AC 86 ms
12,160 KB
testcase_02 AC 83 ms
12,288 KB
testcase_03 AC 81 ms
12,288 KB
testcase_04 AC 80 ms
12,416 KB
testcase_05 AC 78 ms
12,160 KB
testcase_06 AC 80 ms
12,160 KB
testcase_07 AC 83 ms
12,288 KB
testcase_08 AC 86 ms
12,288 KB
testcase_09 AC 87 ms
12,160 KB
testcase_10 AC 83 ms
12,160 KB
testcase_11 AC 86 ms
12,160 KB
testcase_12 AC 85 ms
12,160 KB
testcase_13 AC 135 ms
14,336 KB
testcase_14 AC 132 ms
14,208 KB
testcase_15 AC 128 ms
14,208 KB
testcase_16 AC 131 ms
14,464 KB
testcase_17 AC 128 ms
14,208 KB
testcase_18 AC 83 ms
12,288 KB
testcase_19 AC 82 ms
12,416 KB
testcase_20 AC 80 ms
12,160 KB
testcase_21 AC 75 ms
12,160 KB
testcase_22 WA -
testcase_23 AC 77 ms
12,160 KB
testcase_24 AC 157 ms
17,920 KB
testcase_25 WA -
testcase_26 AC 192 ms
14,796 KB
testcase_27 AC 166 ms
14,464 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

$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") 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") then
  $ans += 1
end


puts $ans
0