結果

問題 No.1463 Hungry Kanten
ユーザー homesentinelhomesentinel
提出日時 2021-04-02 23:42:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,610 ms / 2,000 ms
コード長 436 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 10,588 KB
実行使用メモリ 28,396 KB
最終ジャッジ日時 2023-08-25 15:06:00
合計ジャッジ時間 7,832 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,848 KB
testcase_01 AC 15 ms
7,804 KB
testcase_02 AC 97 ms
8,772 KB
testcase_03 AC 1,550 ms
7,896 KB
testcase_04 AC 22 ms
7,828 KB
testcase_05 AC 1,610 ms
28,396 KB
testcase_06 AC 15 ms
7,856 KB
testcase_07 AC 15 ms
7,892 KB
testcase_08 AC 15 ms
7,860 KB
testcase_09 AC 15 ms
7,924 KB
testcase_10 AC 17 ms
7,864 KB
testcase_11 AC 17 ms
7,856 KB
testcase_12 AC 20 ms
8,176 KB
testcase_13 AC 24 ms
7,800 KB
testcase_14 AC 33 ms
8,416 KB
testcase_15 AC 51 ms
7,864 KB
testcase_16 AC 97 ms
9,104 KB
testcase_17 AC 185 ms
11,528 KB
testcase_18 AC 338 ms
8,856 KB
testcase_19 AC 805 ms
18,264 KB
testcase_20 AC 1,586 ms
27,492 KB
testcase_21 AC 17 ms
7,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int, input().split()))

# print(A)
st = set()
for mask in range(1, 1 << N):
    su = 0
    pi = 1
    # print("mask " + str(mask))
    cnt = 0
    for i in range(N):
        if mask >> i & 1:
            su += A[i]
            pi *= A[i]
            cnt += 1
            # print(i, end = ' ')
    # print()
    if cnt >= K:
        st.add(su)
        st.add(pi)

# print(st)
print(len(st))
0