結果

問題 No.1463 Hungry Kanten
ユーザー Kanten4205
提出日時 2021-03-07 22:08:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 764 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 82,044 KB
実行使用メモリ 118,812 KB
最終ジャッジ日時 2025-06-20 01:29:50
合計ジャッジ時間 4,964 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

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