結果

問題 No.1463 Hungry Kanten
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2021-04-02 22:35:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,966 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 10,868 KB
実行使用メモリ 44,872 KB
最終ジャッジ日時 2023-08-25 15:03:10
合計ジャッジ時間 8,290 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,840 KB
testcase_01 AC 15 ms
7,808 KB
testcase_02 AC 83 ms
9,704 KB
testcase_03 AC 1,856 ms
32,916 KB
testcase_04 AC 18 ms
7,816 KB
testcase_05 AC 1,966 ms
44,872 KB
testcase_06 AC 15 ms
7,824 KB
testcase_07 AC 15 ms
7,752 KB
testcase_08 AC 16 ms
7,940 KB
testcase_09 AC 15 ms
7,812 KB
testcase_10 AC 16 ms
7,864 KB
testcase_11 AC 18 ms
7,916 KB
testcase_12 AC 20 ms
8,356 KB
testcase_13 AC 18 ms
7,940 KB
testcase_14 AC 33 ms
8,656 KB
testcase_15 AC 26 ms
7,812 KB
testcase_16 AC 82 ms
9,692 KB
testcase_17 AC 213 ms
13,712 KB
testcase_18 AC 143 ms
9,436 KB
testcase_19 AC 884 ms
26,128 KB
testcase_20 AC 1,348 ms
35,044 KB
testcase_21 AC 17 ms
7,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def bpc(n):
    ans = 0
    while n:
        if n & 1: ans += 1
        n >>= 1
    return ans

n,k = map(int,input().split())
a = list(map(int,input().split()))
s = []
for i in range(1<<n):
    if bpc(i) < k: continue
    sum = 0
    mul = 1
    for j in range(n):
        if i & (1<<j):
            sum += a[j]
            mul *= a[j]
    s += [sum,mul]
print(len(set(s)))
0