結果

問題 No.1463 Hungry Kanten
ユーザー MtSakaMtSaka
提出日時 2021-03-08 13:44:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,461 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 10,584 KB
実行使用メモリ 28,564 KB
最終ジャッジ日時 2023-08-25 14:45:06
合計ジャッジ時間 6,720 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,816 KB
testcase_01 AC 13 ms
7,920 KB
testcase_02 AC 85 ms
8,852 KB
testcase_03 AC 1,428 ms
7,856 KB
testcase_04 AC 17 ms
7,868 KB
testcase_05 AC 1,461 ms
28,564 KB
testcase_06 AC 13 ms
8,008 KB
testcase_07 AC 13 ms
7,816 KB
testcase_08 AC 13 ms
7,868 KB
testcase_09 AC 12 ms
7,868 KB
testcase_10 AC 12 ms
7,816 KB
testcase_11 AC 14 ms
7,916 KB
testcase_12 AC 16 ms
8,396 KB
testcase_13 AC 18 ms
7,864 KB
testcase_14 AC 27 ms
8,404 KB
testcase_15 AC 41 ms
7,972 KB
testcase_16 AC 81 ms
9,204 KB
testcase_17 AC 156 ms
11,644 KB
testcase_18 AC 299 ms
8,856 KB
testcase_19 AC 663 ms
18,216 KB
testcase_20 AC 1,381 ms
27,648 KB
testcase_21 AC 15 ms
7,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=list(map(int, input().split()))
a=list(map(int, input().split()))
b=set()
for i in range((1<<k)-1,(1<<n)):
    al=0
    cnt=0
    pro=1
    for j in range(0, n):
        if i & (1 << j):
            al+=a[j]
            pro*=a[j]
            cnt+=1
        
    if cnt >= k:
        b.add(al)
        b.add(pro)
print(len(b))
0