We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 015421c commit 8aa4a5fCopy full SHA for 8aa4a5f
atcoder/abc044/C/main.cpp
@@ -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