結果

問題 No.1463 Hungry Kanten
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-04-02 22:40:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 366 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 86,820 KB
実行使用メモリ 119,984 KB
最終ジャッジ日時 2023-08-25 15:03:26
合計ジャッジ時間 4,254 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,220 KB
testcase_01 AC 80 ms
71,176 KB
testcase_02 AC 101 ms
77,976 KB
testcase_03 AC 242 ms
77,232 KB
testcase_04 AC 87 ms
76,572 KB
testcase_05 AC 366 ms
119,984 KB
testcase_06 AC 72 ms
71,248 KB
testcase_07 AC 72 ms
71,304 KB
testcase_08 AC 76 ms
71,104 KB
testcase_09 AC 76 ms
71,016 KB
testcase_10 AC 77 ms
76,232 KB
testcase_11 AC 84 ms
76,568 KB
testcase_12 AC 87 ms
76,588 KB
testcase_13 AC 88 ms
76,484 KB
testcase_14 AC 93 ms
76,652 KB
testcase_15 AC 92 ms
76,608 KB
testcase_16 AC 103 ms
78,332 KB
testcase_17 AC 118 ms
80,464 KB
testcase_18 AC 109 ms
77,520 KB
testcase_19 AC 216 ms
93,900 KB
testcase_20 AC 277 ms
101,956 KB
testcase_21 AC 81 ms
76,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))
s = set()
for b in range(1 << n):
    l = []
    for i in range(n):
        if 1 << i & b:
            l.append(a[i])
    if len(l) < k: continue
    su, pr = 0, 1
    for i in l:
        su += i
        pr *= i
    s.add(su)
    s.add(pr)
print(len(s))
0