結果

問題 No.145 yukiover
ユーザー gigurururugigurururu
提出日時 2015-02-06 23:24:50
言語 Ruby
(3.2.2)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 267 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 11,572 KB
実行使用メモリ 21,868 KB
最終ジャッジ日時 2023-08-26 23:12:36
合計ジャッジ時間 3,867 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
15,180 KB
testcase_01 AC 78 ms
15,264 KB
testcase_02 AC 73 ms
15,312 KB
testcase_03 AC 73 ms
15,096 KB
testcase_04 AC 73 ms
15,160 KB
testcase_05 AC 79 ms
15,300 KB
testcase_06 AC 74 ms
15,252 KB
testcase_07 AC 72 ms
15,316 KB
testcase_08 AC 75 ms
15,176 KB
testcase_09 AC 72 ms
15,176 KB
testcase_10 AC 70 ms
15,052 KB
testcase_11 AC 108 ms
21,472 KB
testcase_12 AC 112 ms
21,728 KB
testcase_13 AC 111 ms
21,404 KB
testcase_14 AC 115 ms
21,672 KB
testcase_15 AC 112 ms
21,696 KB
testcase_16 AC 110 ms
21,284 KB
testcase_17 AC 113 ms
21,792 KB
testcase_18 AC 109 ms
21,752 KB
testcase_19 AC 109 ms
21,868 KB
testcase_20 AC 114 ms
21,776 KB
testcase_21 AC 114 ms
21,828 KB
testcase_22 AC 114 ms
21,688 KB
testcase_23 AC 110 ms
21,504 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def count s,c
  if u=s[0]
    k=[H[u],count(s[1..-1],(u.ord-1).chr)].min
    (u.succ..c).inject(0){|t,r|t+H[r]}+k+(H[u]-k)/2
  else
    (?a..c).inject(0){|t,r|t+H[r]}
  end
end
gets
H=Hash[gets.chars.group_by{|c|c}.map{|k,v|[k,v.size]}]
H.default=0
p count("yuki",?z)
0