結果

問題 No.1463 Hungry Kanten
ユーザー Manuel1024Manuel1024
提出日時 2021-04-04 19:16:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 298 ms / 2,000 ms
コード長 343 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 114,668 KB
最終ジャッジ日時 2023-08-27 20:31:23
合計ジャッジ時間 3,756 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,176 KB
testcase_01 AC 69 ms
71,172 KB
testcase_02 AC 85 ms
77,240 KB
testcase_03 AC 218 ms
77,464 KB
testcase_04 AC 80 ms
76,992 KB
testcase_05 AC 298 ms
114,668 KB
testcase_06 AC 69 ms
71,272 KB
testcase_07 AC 70 ms
71,264 KB
testcase_08 AC 68 ms
71,472 KB
testcase_09 AC 70 ms
71,172 KB
testcase_10 AC 75 ms
76,856 KB
testcase_11 AC 77 ms
76,440 KB
testcase_12 AC 80 ms
76,660 KB
testcase_13 AC 79 ms
76,684 KB
testcase_14 AC 84 ms
76,740 KB
testcase_15 AC 86 ms
76,844 KB
testcase_16 AC 89 ms
77,836 KB
testcase_17 AC 106 ms
81,212 KB
testcase_18 AC 106 ms
77,728 KB
testcase_19 AC 163 ms
94,200 KB
testcase_20 AC 238 ms
102,076 KB
testcase_21 AC 75 ms
76,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))

ans = set()
for bit in range(1 << n):
    cnt = 0
    sig = 0
    pro = 1
    for i in range(n):
        if bit & (1 << i):
            cnt += 1
            sig += a[i]
            pro *= a[i]
    
    if cnt >= k:
        ans.add(sig)
        ans.add(pro)

print(len(ans))
0