結果

問題 No.1463 Hungry Kanten
ユーザー phsplsphspls
提出日時 2022-11-06 00:52:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 462 ms / 2,000 ms
コード長 397 bytes
コンパイル時間 1,295 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 131,588 KB
最終ジャッジ日時 2023-09-26 23:50:16
合計ジャッジ時間 5,570 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,480 KB
testcase_01 AC 77 ms
71,320 KB
testcase_02 AC 113 ms
78,616 KB
testcase_03 AC 311 ms
77,684 KB
testcase_04 AC 93 ms
76,828 KB
testcase_05 AC 462 ms
131,588 KB
testcase_06 AC 76 ms
71,496 KB
testcase_07 AC 76 ms
71,272 KB
testcase_08 AC 77 ms
71,472 KB
testcase_09 AC 76 ms
71,396 KB
testcase_10 AC 85 ms
76,308 KB
testcase_11 AC 90 ms
76,296 KB
testcase_12 AC 95 ms
76,760 KB
testcase_13 AC 91 ms
76,660 KB
testcase_14 AC 106 ms
77,632 KB
testcase_15 AC 101 ms
77,332 KB
testcase_16 AC 115 ms
79,044 KB
testcase_17 AC 139 ms
80,732 KB
testcase_18 AC 136 ms
78,408 KB
testcase_19 AC 270 ms
98,980 KB
testcase_20 AC 367 ms
111,092 KB
testcase_21 AC 90 ms
76,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

result = set()
for i in range(1, 1<<N):
    cnt = sum([(i >> j) & 1 for j in range(0, N)])
    if cnt < K:
        continue
    addval = 0
    mulval = 1
    for j in range(N):
        if ((i >> j) & 1) == 1:
            addval += A[j]
            mulval *= A[j]
    result.add(addval)
    result.add(mulval)
print(len(result))
0