結果

問題 No.1463 Hungry Kanten
ユーザー ああいいああいい
提出日時 2021-12-27 15:28:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,936 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 11,944 KB
実行使用メモリ 30,408 KB
最終ジャッジ日時 2023-10-26 00:58:41
合計ジャッジ時間 9,003 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,072 KB
testcase_01 AC 29 ms
10,072 KB
testcase_02 AC 122 ms
10,784 KB
testcase_03 AC 1,916 ms
10,072 KB
testcase_04 AC 37 ms
10,072 KB
testcase_05 AC 1,936 ms
30,408 KB
testcase_06 AC 27 ms
10,072 KB
testcase_07 AC 27 ms
10,072 KB
testcase_08 AC 27 ms
10,072 KB
testcase_09 AC 28 ms
10,072 KB
testcase_10 AC 27 ms
10,112 KB
testcase_11 AC 29 ms
10,116 KB
testcase_12 AC 32 ms
10,180 KB
testcase_13 AC 34 ms
10,108 KB
testcase_14 AC 45 ms
10,260 KB
testcase_15 AC 67 ms
10,120 KB
testcase_16 AC 118 ms
11,044 KB
testcase_17 AC 223 ms
13,404 KB
testcase_18 AC 434 ms
10,788 KB
testcase_19 AC 960 ms
20,140 KB
testcase_20 AC 1,836 ms
29,540 KB
testcase_21 AC 27 ms
10,072 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