Skip to content

Commit 8aa4a5f

Browse files
committed
atcoder/abc044C
1 parent 015421c commit 8aa4a5f

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

atcoder/abc044/C/main.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = int64_t;
5+
using ff = long double;
6+
7+
int N, A;
8+
vector<int> xs;
9+
10+
ll solve() {
11+
const int M = 50 * 50;
12+
vector<vector<ll>> DP(N+1, vector<ll>(M+1, 0));
13+
DP[0][0] = 1;
14+
15+
for (auto x : xs) {
16+
for (int i = N; i > 0; --i) {
17+
for (int j = M; j - x >= 0; --j) {
18+
DP[i][j] += DP[i-1][j-x];
19+
}
20+
}
21+
}
22+
23+
ll ans = 0;
24+
for (int i = 1; i <= N; ++i) {
25+
ans += DP[i][i*A];
26+
}
27+
return ans;
28+
}
29+
30+
int main() {
31+
ios_base::sync_with_stdio(false);
32+
cin.tie(0); cout.tie(0);
33+
34+
cin >> N >> A;
35+
xs.assign(N, 0);
36+
for (auto &x : xs) cin >> x;
37+
cout << solve() << endl;
38+
39+
return 0;
40+
}

0 commit comments

Comments
 (0)