結果

問題 No.1463 Hungry Kanten
ユーザー shiomusubi496shiomusubi496
提出日時 2021-04-02 22:03:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 404 ms / 2,000 ms
コード長 274 bytes
コンパイル時間 559 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 156,128 KB
最終ジャッジ日時 2023-08-25 14:59:22
合計ジャッジ時間 4,255 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,664 KB
testcase_01 AC 72 ms
71,368 KB
testcase_02 AC 105 ms
79,372 KB
testcase_03 AC 381 ms
121,484 KB
testcase_04 AC 77 ms
76,476 KB
testcase_05 AC 404 ms
156,128 KB
testcase_06 AC 71 ms
71,300 KB
testcase_07 AC 73 ms
71,412 KB
testcase_08 AC 72 ms
71,592 KB
testcase_09 AC 72 ms
71,172 KB
testcase_10 AC 77 ms
76,656 KB
testcase_11 AC 83 ms
76,248 KB
testcase_12 AC 85 ms
76,972 KB
testcase_13 AC 80 ms
76,840 KB
testcase_14 AC 92 ms
77,016 KB
testcase_15 AC 88 ms
77,024 KB
testcase_16 AC 101 ms
79,512 KB
testcase_17 AC 122 ms
84,920 KB
testcase_18 AC 99 ms
78,492 KB
testcase_19 AC 226 ms
111,628 KB
testcase_20 AC 287 ms
124,004 KB
testcase_21 AC 79 ms
76,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=list(map(int,input().split()))
ans=[]
for i in range(1<<N):
  cnt=0
  for j in range(N):
    cnt+=(i>>j)&1
  if cnt<K:
    continue
  a=0
  b=1
  for j in range(N):
    if (i>>j)&1:
      a+=A[j]
      b*=A[j]
  ans+=[a,b]
print(len(set(ans)))
0