結果
問題 |
No.279 木の数え上げ
|
ユーザー |
|
提出日時 | 2017-09-12 02:31:53 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 94 ms / 2,000 ms |
コード長 | 625 bytes |
コンパイル時間 | 102 ms |
コンパイル使用メモリ | 7,680 KB |
実行使用メモリ | 14,080 KB |
最終ジャッジ日時 | 2024-11-07 16:01:54 |
合計ジャッジ時間 | 2,759 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
コンパイルメッセージ
Syntax OK
ソースコード
class CountUpTrees attr_reader :s def initialize(s: "") @s = s end def cause begin @s = gets.chomp rescue end end def countuptrees(target, str) str_hash = {} str.split("").uniq.each do |c| str_hash[c] = str.count(c) end cnt_ary = str_hash.each.map do |c, cnt| target.count(c) / cnt end cnt_ary.min end def result puts countuptrees(@s, "tree") end def run cause result end end if $0 == __FILE__ CountUpTrees.new.run end