結果

問題 No.1463 Hungry Kanten
ユーザー marroncastlemarroncastle
提出日時 2021-04-02 22:27:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 315 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 483 ms
コンパイル使用メモリ 87,340 KB
実行使用メモリ 114,912 KB
最終ジャッジ日時 2023-08-25 15:02:12
合計ジャッジ時間 3,847 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,528 KB
testcase_01 AC 72 ms
71,328 KB
testcase_02 AC 88 ms
77,276 KB
testcase_03 AC 217 ms
77,276 KB
testcase_04 AC 83 ms
76,864 KB
testcase_05 AC 315 ms
114,912 KB
testcase_06 AC 71 ms
71,300 KB
testcase_07 AC 70 ms
71,552 KB
testcase_08 AC 69 ms
71,432 KB
testcase_09 AC 72 ms
71,172 KB
testcase_10 AC 76 ms
76,652 KB
testcase_11 AC 79 ms
76,148 KB
testcase_12 AC 81 ms
76,840 KB
testcase_13 AC 82 ms
76,720 KB
testcase_14 AC 85 ms
76,840 KB
testcase_15 AC 87 ms
76,796 KB
testcase_16 AC 91 ms
77,824 KB
testcase_17 AC 103 ms
81,712 KB
testcase_18 AC 105 ms
77,804 KB
testcase_19 AC 169 ms
93,992 KB
testcase_20 AC 250 ms
102,156 KB
testcase_21 AC 76 ms
76,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = set()
for bit in range(1<<N):
  cnt = 0
  plus = 0
  multi = 1
  for i in range(N):
    if (bit>>i)%2:
      cnt += 1
      plus += A[i]
      multi *= A[i]
  if cnt<K:
    continue
  ans.add(plus)
  ans.add(multi)
print(len(ans))
0