結果

問題 No.1463 Hungry Kanten
ユーザー nok0
提出日時 2021-04-02 21:38:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,776 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 30,600 KB
最終ジャッジ日時 2025-06-20 01:31:40
合計ジャッジ時間 11,729 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))
st = set()
for b in range(1 << n):
    s, m, c = 0, 1, 0
    for j in range(n):
        if b >> j & 1:
            s += a[j]
            m *= a[j]
            c += 1
    if c >= k:
        st.add(s)
        st.add(m)

print(len(st))
0