結果

問題 No.73 helloworld
ユーザー cielciel
提出日時 2014-11-20 23:41:38
言語 Ruby
(3.3.0)
結果
AC  
実行時間 86 ms / 5,000 ms
コード長 370 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 11,376 KB
実行使用メモリ 15,328 KB
最終ジャッジ日時 2023-09-11 07:25:24
合計ジャッジ時間 2,184 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,296 KB
testcase_01 AC 83 ms
15,228 KB
testcase_02 AC 83 ms
15,296 KB
testcase_03 AC 83 ms
15,132 KB
testcase_04 AC 85 ms
15,292 KB
testcase_05 AC 82 ms
15,136 KB
testcase_06 AC 82 ms
15,196 KB
testcase_07 AC 83 ms
15,292 KB
testcase_08 AC 85 ms
15,052 KB
testcase_09 AC 83 ms
15,204 KB
testcase_10 AC 81 ms
15,320 KB
testcase_11 AC 86 ms
15,328 KB
testcase_12 AC 81 ms
15,220 KB
testcase_13 AC 81 ms
15,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/usr/bin/ruby: warning: shebang line ending with \r may cause problems
Syntax OK

ソースコード

diff #

#!/usr/bin/ruby
def comb(n,r)
	return 0 if n<r
	return (n-r+1..n).reduce(:*)/(1..r).reduce(:*)
end
h=Hash[*[*'A'..'Z'].zip($<.map(&:to_i)).flatten(1)]
if h['L']<3
	p 0
	exit
end
r=comb(h['H'],1)*comb(h['E'],1)*comb(h['O']/2,1)*comb(h['O']-h['O']/2,1)*comb(h['W'],1)*comb(h['R'],1)*comb(h['D'],1)
r*=2.step(h['L']-1).map{|e|comb(e,2)*comb(h['L']-e,1)}.max
p r
0