結果

問題 No.1463 Hungry Kanten
ユーザー lloyz
提出日時 2022-03-14 21:14:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 82,620 KB
実行使用メモリ 113,980 KB
最終ジャッジ日時 2025-06-20 01:39:06
合計ジャッジ時間 2,643 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations

n, k = map(int, input().split())
A = list(map(int, input().split()))

ANS = set()
for r in range(k, n + 1):
    for C in combinations(range(n), r):
        add_temp = 0
        product_temp = 1
        for idx in C:
            add_temp += A[idx]
            product_temp *= A[idx]
        ANS.add(add_temp)
        ANS.add(product_temp)
print(len(ANS))
0