結果
| 問題 | No.73 helloworld |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-11-20 23:41:38 |
| 言語 | Ruby (4.0.2) |
| 結果 |
AC
|
| 実行時間 | 54 ms / 5,000 ms |
| コード長 | 370 bytes |
| 記録 | |
| コンパイル時間 | 314 ms |
| コンパイル使用メモリ | 8,832 KB |
| 実行使用メモリ | 14,976 KB |
| 最終ジャッジ日時 | 2026-03-18 02:28:47 |
| 合計ジャッジ時間 | 1,961 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
コンパイルメッセージ
Main.rb:1: warning: shebang line ending with \r may cause problems Syntax OK
ソースコード
#!/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