結果

問題 No.1463 Hungry Kanten
ユーザー stngstng
提出日時 2021-08-28 14:30:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 433 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 122,020 KB
最終ジャッジ日時 2024-05-01 15:57:27
合計ジャッジ時間 3,505 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,096 KB
testcase_01 AC 38 ms
51,712 KB
testcase_02 AC 83 ms
76,916 KB
testcase_03 AC 305 ms
75,928 KB
testcase_04 AC 57 ms
66,688 KB
testcase_05 AC 433 ms
122,020 KB
testcase_06 AC 38 ms
52,096 KB
testcase_07 AC 37 ms
51,816 KB
testcase_08 AC 38 ms
52,096 KB
testcase_09 AC 38 ms
52,480 KB
testcase_10 AC 46 ms
60,928 KB
testcase_11 AC 49 ms
61,548 KB
testcase_12 AC 55 ms
65,408 KB
testcase_13 AC 56 ms
66,560 KB
testcase_14 AC 68 ms
72,448 KB
testcase_15 AC 62 ms
71,800 KB
testcase_16 AC 83 ms
77,312 KB
testcase_17 AC 95 ms
79,204 KB
testcase_18 AC 112 ms
76,928 KB
testcase_19 AC 221 ms
92,536 KB
testcase_20 AC 357 ms
101,952 KB
testcase_21 AC 46 ms
61,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
a = [int(i) for i in input().split()]

num = 2**n
ans = set()

for i in range(num):
    tmp = format(i, '0'+str(n)+'b')
    sm = 0
    sk = 1
    cnt = 0
    for j in range(n):
        if tmp[j] == "1":
            sm += a[j]
            sk *= a[j]
            cnt += 1
    if cnt >= k:
        ans.add(sm)
        ans.add(sk)
        
print(len(ans))
0