結果
問題 | No.73 helloworld |
ユーザー |
|
提出日時 | 2014-11-20 23:41:38 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 87 ms / 5,000 ms |
コード長 | 370 bytes |
コンパイル時間 | 232 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-06-28 21:51:41 |
合計ジャッジ時間 | 2,394 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 |
コンパイルメッセージ
ruby: 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