結果

問題 No.1463 Hungry Kanten
ユーザー AhykwAhykw
提出日時 2021-04-02 23:06:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,676 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 10,688 KB
実行使用メモリ 28,508 KB
最終ジャッジ日時 2023-08-25 15:04:39
合計ジャッジ時間 8,010 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,852 KB
testcase_01 AC 16 ms
7,872 KB
testcase_02 AC 95 ms
8,904 KB
testcase_03 AC 1,546 ms
7,936 KB
testcase_04 AC 24 ms
7,844 KB
testcase_05 AC 1,600 ms
28,508 KB
testcase_06 AC 16 ms
7,880 KB
testcase_07 AC 16 ms
7,904 KB
testcase_08 AC 16 ms
7,844 KB
testcase_09 AC 16 ms
7,952 KB
testcase_10 AC 16 ms
7,792 KB
testcase_11 AC 18 ms
7,852 KB
testcase_12 AC 20 ms
8,248 KB
testcase_13 AC 23 ms
7,800 KB
testcase_14 AC 33 ms
8,408 KB
testcase_15 AC 52 ms
7,908 KB
testcase_16 AC 97 ms
9,088 KB
testcase_17 AC 195 ms
11,464 KB
testcase_18 AC 366 ms
8,856 KB
testcase_19 AC 802 ms
18,200 KB
testcase_20 AC 1,676 ms
27,644 KB
testcase_21 AC 18 ms
7,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = [int(x) for x in input().split(" ")]

a = [int(x) for x in input().split(" ")]

s = set()

for i in range(1 << n):
    cnt = 0

    sm = 0
    mul = 1

    for j in range(n):
        if i >> j & 1:
            cnt += 1
            sm += a[j]
            mul *= a[j]

    if cnt < k:
        continue

    s.add(sm)
    s.add(mul)

print(len(s))
0