結果

問題 No.1463 Hungry Kanten
ユーザー gyouzasushigyouzasushi
提出日時 2021-04-02 21:32:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 334 ms / 2,000 ms
コード長 312 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 123,088 KB
最終ジャッジ日時 2023-08-25 14:49:01
合計ジャッジ時間 3,750 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
71,400 KB
testcase_01 AC 58 ms
71,256 KB
testcase_02 AC 81 ms
78,252 KB
testcase_03 AC 266 ms
77,280 KB
testcase_04 AC 63 ms
76,356 KB
testcase_05 AC 334 ms
123,088 KB
testcase_06 AC 60 ms
71,124 KB
testcase_07 AC 64 ms
71,156 KB
testcase_08 AC 59 ms
71,140 KB
testcase_09 AC 58 ms
71,516 KB
testcase_10 AC 64 ms
76,588 KB
testcase_11 AC 65 ms
76,084 KB
testcase_12 AC 72 ms
76,904 KB
testcase_13 AC 69 ms
76,472 KB
testcase_14 AC 76 ms
76,812 KB
testcase_15 AC 74 ms
76,644 KB
testcase_16 AC 82 ms
78,596 KB
testcase_17 AC 98 ms
80,488 KB
testcase_18 AC 110 ms
78,064 KB
testcase_19 AC 211 ms
95,836 KB
testcase_20 AC 264 ms
103,284 KB
testcase_21 AC 66 ms
76,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))
st = set()
for bit in range(1 << n):
    if bin(bit).count('1') < k:
        continue
    sm, pr = 0, 1
    for i in range(n):
        if bit >> i & 1:
            sm += a[i]
            pr *= a[i]
    st.add(sm)
    st.add(pr)
print(len(st))
0