結果

問題 No.1463 Hungry Kanten
ユーザー kohei2019
提出日時 2022-05-21 12:13:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 351 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 82,388 KB
実行使用メモリ 120,988 KB
最終ジャッジ日時 2025-06-20 01:39:22
合計ジャッジ時間 3,455 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
lsA = list(map(int,input().split()))
aset = set()

for i in range(2**N):
    if bin(i).count('1') < K:
        continue
    asum = 0
    apro = 1
    for j in range(N):
        if (i>>j)&1:
            asum += lsA[j]
            apro *= lsA[j]
    aset.add(asum)
    aset.add(apro)

print(len(aset))
0