結果

問題 No.1463 Hungry Kanten
コンテスト
ユーザー Ahykw
提出日時 2021-04-02 23:06:08
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 1,211 ms / 2,000 ms
+ 527µs
コード長 352 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 292 ms
コンパイル使用メモリ 21,412 KB
実行使用メモリ 35,448 KB
最終ジャッジ日時 2026-07-12 09:00:55
合計ジャッジ時間 10,617 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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