結果

問題 No.1463 Hungry Kanten
ユーザー Kanten4205Kanten4205
提出日時 2021-03-07 22:08:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 890 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 1,291 ms
コンパイル使用メモリ 86,360 KB
実行使用メモリ 125,088 KB
最終ジャッジ日時 2023-08-25 14:43:37
合計ジャッジ時間 5,493 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
70,724 KB
testcase_01 AC 70 ms
70,864 KB
testcase_02 AC 107 ms
76,808 KB
testcase_03 AC 572 ms
125,084 KB
testcase_04 AC 82 ms
76,280 KB
testcase_05 AC 890 ms
125,088 KB
testcase_06 AC 69 ms
70,844 KB
testcase_07 AC 69 ms
71,132 KB
testcase_08 AC 71 ms
71,136 KB
testcase_09 AC 70 ms
70,872 KB
testcase_10 AC 75 ms
75,876 KB
testcase_11 AC 79 ms
75,724 KB
testcase_12 AC 84 ms
76,360 KB
testcase_13 AC 81 ms
76,312 KB
testcase_14 AC 91 ms
76,160 KB
testcase_15 AC 87 ms
76,552 KB
testcase_16 AC 107 ms
77,004 KB
testcase_17 AC 166 ms
81,972 KB
testcase_18 AC 122 ms
77,240 KB
testcase_19 AC 465 ms
98,016 KB
testcase_20 AC 641 ms
106,652 KB
testcase_21 AC 77 ms
76,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [0]
for i in range(0, (1 << N)):
    sums = 0
    num = 0
    times = 1
    for j in range(0, N):
        if i & (1 << j):
            sums = sums + A[j]
            times = times * A[j]
            num = num + 1
        
    if num >= K:
        B.append(sums)
        B.append(times)
    
C = sorted(B)
ans = 0
for i in range(1, len(C)):
    if C[i-1] != C[i]:
        ans = ans + 1
    
print(ans)
0