結果
問題 | No.73 helloworld |
ユーザー |
![]() |
提出日時 | 2016-03-26 03:21:11 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 82 ms / 5,000 ms |
コード長 | 855 bytes |
コンパイル時間 | 70 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-06-29 13:13:45 |
合計ジャッジ時間 | 1,759 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 |
コンパイルメッセージ
Syntax OK
ソースコード
class Integerdef combination(k)self.factorial/(k.factorial*(self-k).factorial)enddef permutation(k)self.factorial/(self-k).factorialenddef factorialreturn 1 if self == 0(1..self).inject(:*)endendclass Yukicoderdef initializehash = Hash.new(0)26.times do |i|hash[(97+i).chr] = gets.to_iendanswer = 1%w(d e h l o r w).each do |ch|if ch == 'l'max_val = 01.upto(hash[ch]-2) do |n|max_val = [max_val, (hash[ch]-n).combination(2) * n].maxendanswer *= max_valelsif ch == 'o'max_val = 01.upto(hash[ch]-1) do |n|max_val = [max_val, (hash[ch]-n) * n].maxendanswer *= max_valelseanswer *= hash[ch]endendputs answerendendYukicoder.new