結果
| 問題 | 
                            No.996 Phnom Penh
                             | 
                    
| コンテスト | |
| ユーザー | 
                             wonda_t_coffee
                         | 
                    
| 提出日時 | 2020-02-21 22:51:23 | 
| 言語 | Ruby  (3.4.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 331 bytes | 
| コンパイル時間 | 190 ms | 
| コンパイル使用メモリ | 7,680 KB | 
| 実行使用メモリ | 80,352 KB | 
| 最終ジャッジ日時 | 2024-10-08 22:31:09 | 
| 合計ジャッジ時間 | 6,376 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | WA * 24 TLE * 1 | 
コンパイルメッセージ
Syntax OK
ソースコード
s = ''
len = (1..(100)).to_a.sample
len.times do
  s << [?p, ?h, ?n, ?o, ?m, ?e].sample
end
puts s
puts len
s = gets.chomp
ans = 0
while true
  f = false
  t = s.gsub("phnom", "penh")
  f |= s != t
  ans += s.size - t.size
  u = t.gsub("h", "").gsub("e", "h")
  f |= t != u
  break unless f
  ans += 1
  s = u
end
puts ans
            
            
            
        
            
wonda_t_coffee