結果

問題 No.1463 Hungry Kanten
ユーザー milanis48663220milanis48663220
提出日時 2021-04-02 21:43:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,424 ms / 2,000 ms
コード長 359 bytes
コンパイル時間 569 ms
コンパイル使用メモリ 10,768 KB
実行使用メモリ 28,944 KB
最終ジャッジ日時 2023-08-25 14:54:04
合計ジャッジ時間 7,274 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,720 KB
testcase_01 AC 15 ms
8,588 KB
testcase_02 AC 83 ms
9,520 KB
testcase_03 AC 1,385 ms
8,720 KB
testcase_04 AC 23 ms
8,796 KB
testcase_05 AC 1,389 ms
28,944 KB
testcase_06 AC 18 ms
8,804 KB
testcase_07 AC 18 ms
8,628 KB
testcase_08 AC 17 ms
8,668 KB
testcase_09 AC 18 ms
8,760 KB
testcase_10 AC 18 ms
8,788 KB
testcase_11 AC 18 ms
8,636 KB
testcase_12 AC 21 ms
8,700 KB
testcase_13 AC 24 ms
8,608 KB
testcase_14 AC 32 ms
8,764 KB
testcase_15 AC 45 ms
8,800 KB
testcase_16 AC 82 ms
9,708 KB
testcase_17 AC 175 ms
12,124 KB
testcase_18 AC 309 ms
9,304 KB
testcase_19 AC 725 ms
18,700 KB
testcase_20 AC 1,424 ms
28,132 KB
testcase_21 AC 18 ms
8,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
import functools

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

st = set()
for s in range(1, (1<<n)):
    cnt = 0
    p = 1
    sm = 0
    for i in range(n):
        if s&(1<<i):
            cnt+=1
            p *= a[i]
            sm += a[i]
    if cnt >= k:
        st.add(p)
        st.add(sm)

print(len(st))
0