結果

問題 No.1463 Hungry Kanten
ユーザー gorugo30gorugo30
提出日時 2021-04-02 21:25:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 247 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 564 ms
コンパイル使用メモリ 86,764 KB
実行使用メモリ 114,540 KB
最終ジャッジ日時 2023-08-25 14:45:57
合計ジャッジ時間 3,576 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
71,128 KB
testcase_01 AC 58 ms
71,100 KB
testcase_02 AC 89 ms
77,092 KB
testcase_03 AC 179 ms
76,940 KB
testcase_04 AC 69 ms
76,628 KB
testcase_05 AC 247 ms
114,540 KB
testcase_06 AC 58 ms
71,304 KB
testcase_07 AC 56 ms
71,132 KB
testcase_08 AC 57 ms
71,348 KB
testcase_09 AC 56 ms
71,232 KB
testcase_10 AC 63 ms
76,188 KB
testcase_11 AC 67 ms
76,124 KB
testcase_12 AC 67 ms
76,592 KB
testcase_13 AC 67 ms
76,484 KB
testcase_14 AC 70 ms
76,760 KB
testcase_15 AC 71 ms
76,632 KB
testcase_16 AC 73 ms
77,464 KB
testcase_17 AC 86 ms
81,152 KB
testcase_18 AC 90 ms
77,492 KB
testcase_19 AC 143 ms
93,992 KB
testcase_20 AC 213 ms
101,924 KB
testcase_21 AC 69 ms
76,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
st = set()
A = list(map(int, input().split()))
for bit in range(1 << N):
    popcount = 0
    summ = 0
    prod = 1
    for i in range(N):
        if bit >> i & 1:
            popcount += 1
            summ += A[i]
            prod *= A[i]
    if popcount >= K:
        st.add(summ)
        st.add(prod)
print(len(st))
0