結果

問題 No.1463 Hungry Kanten
ユーザー paruf4paruf4
提出日時 2021-04-10 16:02:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 369 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 119,772 KB
最終ジャッジ日時 2023-09-08 12:03:50
合計ジャッジ時間 4,199 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
71,168 KB
testcase_01 AC 78 ms
71,124 KB
testcase_02 AC 115 ms
78,320 KB
testcase_03 AC 247 ms
77,400 KB
testcase_04 AC 91 ms
76,796 KB
testcase_05 AC 369 ms
119,772 KB
testcase_06 AC 78 ms
71,340 KB
testcase_07 AC 76 ms
71,368 KB
testcase_08 AC 76 ms
71,200 KB
testcase_09 AC 78 ms
71,284 KB
testcase_10 AC 90 ms
76,576 KB
testcase_11 AC 89 ms
76,872 KB
testcase_12 AC 90 ms
76,924 KB
testcase_13 AC 94 ms
77,000 KB
testcase_14 AC 99 ms
76,752 KB
testcase_15 AC 102 ms
76,996 KB
testcase_16 AC 113 ms
78,680 KB
testcase_17 AC 122 ms
80,836 KB
testcase_18 AC 121 ms
77,708 KB
testcase_19 AC 224 ms
93,516 KB
testcase_20 AC 301 ms
101,028 KB
testcase_21 AC 86 ms
76,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))
res = set()
for i in range(1 << n):
    cnt = 0
    use = []
    for j in range(n):
        if i & (1 << j):
            cnt += 1
            use.append(j)
    if cnt < k:
        continue
    use_size = len(use)
    tmp1 = 0
    tmp2 = 1
    for j in range(use_size):
        tmp1 += a[use[j]]
        tmp2 *= a[use[j]]
    res.add(tmp1)
    res.add(tmp2)

print(len(res))
0