結果

問題 No.1463 Hungry Kanten
ユーザー ああいいああいい
提出日時 2021-12-27 15:28:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 306 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 81,832 KB
実行使用メモリ 112,016 KB
最終ジャッジ日時 2023-10-26 00:58:51
合計ジャッジ時間 2,953 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,596 KB
testcase_01 AC 38 ms
53,596 KB
testcase_02 AC 59 ms
68,980 KB
testcase_03 AC 197 ms
75,624 KB
testcase_04 AC 52 ms
64,420 KB
testcase_05 AC 306 ms
112,016 KB
testcase_06 AC 38 ms
53,596 KB
testcase_07 AC 38 ms
53,596 KB
testcase_08 AC 38 ms
53,596 KB
testcase_09 AC 38 ms
53,596 KB
testcase_10 AC 44 ms
60,084 KB
testcase_11 AC 48 ms
61,900 KB
testcase_12 AC 50 ms
62,372 KB
testcase_13 AC 50 ms
62,300 KB
testcase_14 AC 53 ms
64,424 KB
testcase_15 AC 57 ms
66,500 KB
testcase_16 AC 60 ms
71,440 KB
testcase_17 AC 73 ms
76,956 KB
testcase_18 AC 83 ms
76,232 KB
testcase_19 AC 157 ms
93,072 KB
testcase_20 AC 244 ms
97,180 KB
testcase_21 AC 46 ms
60,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

s =set()
for i in range(1 << N):
    ans1 = 0
    ans2 = 1
    count = 0
    for j in range(N):
        mask = 1 << j
        if i & mask:
            count += 1
            ans1 += A[j]
            ans2 *= A[j]
    if count >= K:
        s.add(ans1)
        s.add(ans2)
print(len(s))
0