結果

問題 No.73 helloworld
ユーザー yuppe19 😺
提出日時 2015-09-02 19:34:52
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 558 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-06-29 02:46:25
合計ジャッジ時間 1,200 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
from operator import mul
def nCr(n, r):
    if r == 0 or n == r:
        return 1
    k = r if r <= n-r else n-r
    return reduce(mul, xrange(n, n-k, -1)) / reduce(mul, xrange(1, k+1))

dic = {ch: ord(ch)-ord('a') for ch in 'helloworld'}

c = [int(raw_input()) for _ in xrange(26)]
res = 1
for ch, pos in dic.items():
    n = c[pos]
    x = n
    if ch == 'l':
        x = max(nCr(a, 2) * (n-a) for a in xrange(2, n)) if n>2 else 0
    elif ch == 'o':
        x = max(a * (n-a) for a in xrange(1, n)) if n>1 else 0
    res *= x
print res 
0