結果

問題 No.73 helloworld
ユーザー lam6er
提出日時 2025-04-09 21:01:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 37 ms / 5,000 ms
コード長 776 bytes
コンパイル時間 647 ms
コンパイル使用メモリ 82,296 KB
実行使用メモリ 53,688 KB
最終ジャッジ日時 2025-04-09 21:02:59
合計ジャッジ時間 1,561 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

# Read input
counts = [int(input()) for _ in range(26)]

# Extract the required counts
h = counts[7]
e = counts[4]
l_count = counts[11]
o = counts[14]
w = counts[22]
r = counts[17]
d = counts[3]

# Check if the required characters are present in sufficient amounts
if h < 1 or e < 1 or l_count < 3 or o < 2 or w < 1 or r < 1 or d < 1:
    print(0)
else:
    # Calculate maximum contribution from 'l'
    max_l = 0
    for x in range(2, l_count):
        # remaining l's = l_count - x
        current = (x * (x - 1) * (l_count - x)) // 2
        if current > max_l:
            max_l = current

    # Calculate maximum contribution from 'o'
    o_contrib = (o // 2) * ((o + 1) // 2)

    # Compute the result
    result = h * e * max_l * o_contrib * w * r * d
    print(result)
0