結果

問題 No.73 helloworld
ユーザー yuppe19 😺yuppe19 😺
提出日時 2015-09-02 19:34:52
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 558 bytes
コンパイル時間 784 ms
コンパイル使用メモリ 7,316 KB
実行使用メモリ 6,192 KB
最終ジャッジ日時 2023-09-11 12:18:50
合計ジャッジ時間 1,467 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,036 KB
testcase_01 AC 11 ms
5,956 KB
testcase_02 AC 12 ms
6,192 KB
testcase_03 AC 11 ms
6,124 KB
testcase_04 AC 12 ms
6,060 KB
testcase_05 AC 12 ms
5,988 KB
testcase_06 AC 12 ms
6,036 KB
testcase_07 AC 12 ms
5,956 KB
testcase_08 AC 12 ms
6,068 KB
testcase_09 AC 12 ms
6,124 KB
testcase_10 AC 12 ms
6,052 KB
testcase_11 AC 11 ms
6,184 KB
testcase_12 AC 12 ms
5,896 KB
testcase_13 AC 12 ms
6,060 KB
権限があれば一括ダウンロードができます

ソースコード

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