結果

問題 No.1463 Hungry Kanten
ユーザー wgrapewgrape
提出日時 2024-02-06 11:44:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 354 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 459 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 120,160 KB
最終ジャッジ日時 2024-02-06 11:44:44
合計ジャッジ時間 3,616 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 66 ms
76,508 KB
testcase_03 AC 197 ms
75,484 KB
testcase_04 AC 41 ms
59,728 KB
testcase_05 AC 354 ms
120,160 KB
testcase_06 AC 35 ms
53,460 KB
testcase_07 AC 36 ms
53,460 KB
testcase_08 AC 36 ms
53,460 KB
testcase_09 AC 36 ms
53,460 KB
testcase_10 AC 43 ms
62,248 KB
testcase_11 AC 46 ms
61,844 KB
testcase_12 AC 48 ms
64,336 KB
testcase_13 AC 45 ms
61,996 KB
testcase_14 AC 52 ms
68,460 KB
testcase_15 AC 52 ms
68,424 KB
testcase_16 AC 64 ms
76,524 KB
testcase_17 AC 80 ms
78,880 KB
testcase_18 AC 68 ms
76,132 KB
testcase_19 AC 190 ms
91,804 KB
testcase_20 AC 227 ms
100,364 KB
testcase_21 AC 46 ms
62,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = set()
def popcnt(x):
    res = 0
    while x:
        res += (x & 1)
        x >>= 1
    return res
for s in range(1 << N):
    if popcnt(s) < K:
        continue
    plus = 0
    mul = 1
    for i in range(N):
        if (s >> i) & 1:
            plus += A[i]
            mul *= A[i]
    ans.add(plus)
    ans.add(mul)
    
print(len(ans))
        
0