結果

問題 No.1463 Hungry Kanten
ユーザー 河野竜也
提出日時 2022-06-20 23:00:40
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,982 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 117 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 30,604 KB
最終ジャッジ日時 2025-06-20 01:39:42
合計ジャッジ時間 13,306 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
a=list(map(int,input().split()))
s=set()
for bit in range(1<<n):
  ans1=0
  ans2=1
  count=0
  for i in range(n):
    if bit&(1<<i):
      ans1+=a[i]
      ans2*=a[i]
      count+=1
  if count>=k:
    s.add(ans1)
    s.add(ans2)
print(len(s))
0