結果

問題 No.1463 Hungry Kanten
ユーザー MtSakaMtSaka
提出日時 2021-03-08 17:53:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,916 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 31,184 KB
最終ジャッジ日時 2024-06-06 09:07:30
合計ジャッジ時間 8,888 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,624 KB
testcase_01 AC 31 ms
10,496 KB
testcase_02 AC 118 ms
11,520 KB
testcase_03 AC 1,790 ms
10,624 KB
testcase_04 AC 35 ms
10,624 KB
testcase_05 AC 1,916 ms
31,184 KB
testcase_06 AC 31 ms
10,624 KB
testcase_07 AC 31 ms
10,752 KB
testcase_08 AC 31 ms
10,624 KB
testcase_09 AC 30 ms
10,624 KB
testcase_10 AC 32 ms
10,752 KB
testcase_11 AC 31 ms
10,624 KB
testcase_12 AC 35 ms
10,880 KB
testcase_13 AC 37 ms
10,496 KB
testcase_14 AC 51 ms
11,008 KB
testcase_15 AC 65 ms
10,624 KB
testcase_16 AC 118 ms
11,648 KB
testcase_17 AC 220 ms
13,792 KB
testcase_18 AC 417 ms
11,392 KB
testcase_19 AC 894 ms
20,796 KB
testcase_20 AC 1,799 ms
30,180 KB
testcase_21 AC 32 ms
10,624 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