結果

問題 No.1463 Hungry Kanten
コンテスト
ユーザー DrDrpilot
提出日時 2022-01-20 13:02:54
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 1,122 ms / 2,000 ms
+ 743µs
コード長 368 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 55 ms
コンパイル使用メモリ 14,592 KB
実行使用メモリ 31,808 KB
最終ジャッジ日時 2026-10-15 13:32:41
合計ジャッジ時間 8,396 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import product
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=set()
for bit in product(range(2),repeat=n):
    if sum(bit)<k:
        continue
    tmp_plus=0
    tmp_times=1
    for i in range(n):
        if bit[i]==1:
            tmp_plus+=a[i]
            tmp_times*=a[i]
    ans.add(tmp_plus)
    ans.add(tmp_times)
print(len(ans))
0