結果

問題 No.1463 Hungry Kanten
ユーザー rodearodea
提出日時 2021-04-09 15:07:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 423 ms / 2,000 ms
コード長 331 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 123,368 KB
最終ジャッジ日時 2023-09-07 03:16:22
合計ジャッジ時間 5,308 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,304 KB
testcase_01 AC 69 ms
71,500 KB
testcase_02 AC 110 ms
78,060 KB
testcase_03 AC 324 ms
77,508 KB
testcase_04 AC 74 ms
76,404 KB
testcase_05 AC 423 ms
123,368 KB
testcase_06 AC 72 ms
71,216 KB
testcase_07 AC 72 ms
71,416 KB
testcase_08 AC 70 ms
71,440 KB
testcase_09 AC 69 ms
71,348 KB
testcase_10 AC 84 ms
76,844 KB
testcase_11 AC 78 ms
76,252 KB
testcase_12 AC 82 ms
76,888 KB
testcase_13 AC 77 ms
76,264 KB
testcase_14 AC 88 ms
77,000 KB
testcase_15 AC 86 ms
76,640 KB
testcase_16 AC 100 ms
78,680 KB
testcase_17 AC 121 ms
80,444 KB
testcase_18 AC 116 ms
78,012 KB
testcase_19 AC 246 ms
95,784 KB
testcase_20 AC 331 ms
103,480 KB
testcase_21 AC 80 ms
76,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = set()
for bit in range(1 << n):
    if bin(bit).count('1') < k:
        continue

    sum = 0
    pro = 1
    for i in range(n):
        if bit & (1 << i):
            sum += a[i]
            pro *= a[i]

    ans.add(sum)
    ans.add(pro)

print(len(ans))
0