結果

問題 No.73 helloworld
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-04-28 15:59:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 846 bytes
コンパイル時間 762 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 8,272 KB
最終ジャッジ日時 2023-09-12 00:31:01
合計ジャッジ時間 1,529 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,864 KB
testcase_01 AC 16 ms
7,860 KB
testcase_02 AC 17 ms
7,776 KB
testcase_03 AC 17 ms
8,220 KB
testcase_04 AC 16 ms
7,956 KB
testcase_05 AC 17 ms
7,908 KB
testcase_06 AC 16 ms
8,220 KB
testcase_07 AC 17 ms
7,948 KB
testcase_08 AC 16 ms
7,860 KB
testcase_09 AC 16 ms
7,904 KB
testcase_10 AC 17 ms
7,812 KB
testcase_11 AC 16 ms
7,964 KB
testcase_12 AC 16 ms
8,272 KB
testcase_13 AC 16 ms
8,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def nC2(n):
    return n * (n - 1) // 2


N = 26

li = [chr(ord('a') + i) for i in range(N)]
c = [int(input()) for i in range(N)]

chrs = set("helloworld")
dic = {}

for x in chrs:
    dic[x] = c[ord(x) - ord('a')]

ans = 1
for x, n in dic.items():
    if x == 'l':
        if n < 3:
            print(0)
            exit()
        t = 1
        rest = n - 3
        for i in range(rest + 1):  # 余ったlをどう割り振るか
            t = max(t, nC2(i + 2) * (1 + rest - i))
        ans *= t
    elif x == 'o':
        if n < 2:
            print(0)
            exit()
        t = 1
        rest = n - 2
        for i in range(rest + 1):  # 余ったlをどう割り振るか
            t = max(t, (i + 1) * (1 + rest - i))
        ans *= t
    else:
        if n < 1:
            print(0)
            exit()
        ans *= n
print(ans)
0