結果

問題 No.1463 Hungry Kanten
ユーザー kohei2019kohei2019
提出日時 2022-05-21 12:13:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 402 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 394 ms
コンパイル使用メモリ 81,844 KB
実行使用メモリ 120,668 KB
最終ジャッジ日時 2023-10-20 15:54:13
合計ジャッジ時間 4,257 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,572 KB
testcase_01 AC 39 ms
53,572 KB
testcase_02 AC 70 ms
76,868 KB
testcase_03 AC 293 ms
75,844 KB
testcase_04 AC 44 ms
62,124 KB
testcase_05 AC 402 ms
120,668 KB
testcase_06 AC 37 ms
53,572 KB
testcase_07 AC 37 ms
53,572 KB
testcase_08 AC 36 ms
53,572 KB
testcase_09 AC 37 ms
53,572 KB
testcase_10 AC 44 ms
62,396 KB
testcase_11 AC 46 ms
61,752 KB
testcase_12 AC 52 ms
64,620 KB
testcase_13 AC 47 ms
62,340 KB
testcase_14 AC 57 ms
68,728 KB
testcase_15 AC 56 ms
68,720 KB
testcase_16 AC 70 ms
76,800 KB
testcase_17 AC 91 ms
79,164 KB
testcase_18 AC 89 ms
76,484 KB
testcase_19 AC 221 ms
91,760 KB
testcase_20 AC 309 ms
101,224 KB
testcase_21 AC 46 ms
62,396 KB
権限があれば一括ダウンロードができます

ソースコード

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