結果

問題 No.1463 Hungry Kanten
ユーザー y61mpnly61mpnl
提出日時 2021-04-02 21:32:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 337 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 86,800 KB
実行使用メモリ 113,952 KB
最終ジャッジ日時 2023-08-25 14:48:49
合計ジャッジ時間 3,991 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,184 KB
testcase_01 AC 68 ms
71,108 KB
testcase_02 AC 96 ms
77,872 KB
testcase_03 AC 250 ms
77,012 KB
testcase_04 AC 85 ms
76,384 KB
testcase_05 AC 337 ms
113,952 KB
testcase_06 AC 70 ms
70,992 KB
testcase_07 AC 70 ms
71,112 KB
testcase_08 AC 70 ms
71,344 KB
testcase_09 AC 70 ms
71,056 KB
testcase_10 AC 76 ms
76,532 KB
testcase_11 AC 80 ms
76,344 KB
testcase_12 AC 83 ms
76,372 KB
testcase_13 AC 84 ms
76,632 KB
testcase_14 AC 86 ms
76,600 KB
testcase_15 AC 92 ms
76,384 KB
testcase_16 AC 98 ms
78,012 KB
testcase_17 AC 109 ms
80,192 KB
testcase_18 AC 124 ms
77,404 KB
testcase_19 AC 197 ms
94,760 KB
testcase_20 AC 277 ms
99,088 KB
testcase_21 AC 80 ms
76,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))

st = set()
for i in range(1<<n):
	tmp = cnt = 0
	for j in range(n):
		if (i>>j)&1:
			tmp += a[j]
			cnt += 1
	if cnt>=k:
		st.add(tmp)

for i in range(1<<n):
	tmp = 1
	cnt = 0
	for j in range(n):
		if (i>>j)&1:
			tmp *= a[j]
			cnt += 1
	if cnt>=k:
		st.add(tmp)

print(len(st))
0