結果

問題 No.73 helloworld
ユーザー cympfhcympfh
提出日時 2016-03-16 10:07:09
言語 Ruby
(3.3.0)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 311 bytes
コンパイル時間 474 ms
コンパイル使用メモリ 11,508 KB
実行使用メモリ 15,396 KB
最終ジャッジ日時 2023-09-11 23:53:18
合計ジャッジ時間 2,810 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
15,140 KB
testcase_01 AC 75 ms
15,248 KB
testcase_02 AC 75 ms
15,116 KB
testcase_03 AC 76 ms
15,044 KB
testcase_04 AC 75 ms
15,304 KB
testcase_05 AC 75 ms
15,288 KB
testcase_06 AC 75 ms
15,152 KB
testcase_07 AC 76 ms
15,092 KB
testcase_08 AC 83 ms
15,396 KB
testcase_09 AC 75 ms
15,160 KB
testcase_10 AC 76 ms
15,168 KB
testcase_11 AC 76 ms
15,084 KB
testcase_12 AC 75 ms
15,084 KB
testcase_13 AC 77 ms
15,292 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

xs={}
readlines.map(&:to_i).each.with_index {|n,i|
  xs[(97+i).chr] = n
}

ans = xs['h'] * xs['e'] * xs['w'] * xs['r'] * xs['d']

def c2(n)
  n*(n-1)/2
end

def o(n)
  (n/2) * (n - n/2)
end

def l(n)
  m = 0
  for k in 1..n
    m = [c2(n-k) * k, m].max
  end
  m
end

ans *= o(xs['o'])
ans *= l(xs['l'])

p ans
0