結果

問題 No.1463 Hungry Kanten
ユーザー MisterMister
提出日時 2021-05-01 01:54:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 431 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 87,296 KB
実行使用メモリ 123,252 KB
最終ジャッジ日時 2023-09-26 10:50:50
合計ジャッジ時間 4,346 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,388 KB
testcase_01 AC 72 ms
71,668 KB
testcase_02 AC 99 ms
78,300 KB
testcase_03 AC 323 ms
77,404 KB
testcase_04 AC 77 ms
76,476 KB
testcase_05 AC 431 ms
123,252 KB
testcase_06 AC 70 ms
71,248 KB
testcase_07 AC 71 ms
71,420 KB
testcase_08 AC 71 ms
71,368 KB
testcase_09 AC 71 ms
71,340 KB
testcase_10 AC 78 ms
76,920 KB
testcase_11 AC 83 ms
76,316 KB
testcase_12 AC 85 ms
77,044 KB
testcase_13 AC 81 ms
76,752 KB
testcase_14 AC 91 ms
76,880 KB
testcase_15 AC 90 ms
76,788 KB
testcase_16 AC 103 ms
78,844 KB
testcase_17 AC 123 ms
80,672 KB
testcase_18 AC 121 ms
78,176 KB
testcase_19 AC 256 ms
96,024 KB
testcase_20 AC 353 ms
103,680 KB
testcase_21 AC 81 ms
76,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ys = set()
for b in range(1 << n):
    if bin(b).count('1') < k:
        continue

    s, p = 0, 1
    for i in range(n):
        if (~b >> i) & 1:
            continue
        s += xs[i]
        p *= xs[i]
    ys.add(s)
    ys.add(p)

print(len(ys))
0