結果

問題 No.1463 Hungry Kanten
ユーザー mesame3993
提出日時 2021-11-19 16:13:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 269 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 82,208 KB
実行使用メモリ 115,504 KB
最終ジャッジ日時 2025-06-20 01:38:36
合計ジャッジ時間 3,082 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  from sys import stdin
  readline=stdin.readline
  n, k = map(int, readline().split())
  A = list(map(int, readline().split()))
  ans = set()
  for i in range(2**n):
    wa, seki = 0, 1
    cnt = 0
    for j in range(n):
      if (i>>j) & 1:
        cnt += 1
        wa += A[j]
        seki *= A[j]
    if cnt < k:
      continue
    ans.add(wa)
    ans.add(seki)
  print(len(ans))
main()
0