結果

問題 No.1463 Hungry Kanten
コンテスト
ユーザー Ahykw
提出日時 2021-04-02 23:06:08
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 1,279 ms / 2,000 ms
+ 853µs
コード長 352 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 286 ms
コンパイル使用メモリ 14,592 KB
実行使用メモリ 31,812 KB
最終ジャッジ日時 2026-10-15 12:12:31
合計ジャッジ時間 11,103 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

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