結果
問題 |
No.1463 Hungry Kanten
|
ユーザー |
|
提出日時 | 2022-05-06 19:59:11 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 352 ms / 2,000 ms |
コード長 | 338 bytes |
コンパイル時間 | 189 ms |
コンパイル使用メモリ | 82,444 KB |
実行使用メモリ | 121,144 KB |
最終ジャッジ日時 | 2025-06-20 01:39:14 |
合計ジャッジ時間 | 3,409 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
n, k = map(int, input().split()) a = list(map(int, input().split())) num_set = set() for i in range(1 << k - 1, 1 << n): if bin(i).count("1") < k: continue s = 0 p = 1 for j in range(n): if i >> j & 1: s += a[j] p *= a[j] num_set.add(s) num_set.add(p) print(len(num_set))