Contest Duration: - (local time) (100 minutes) Back to Home

Submission #855452

Source Code Expand

Copy
```#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>

using namespace std;

#define ll long long
#define SZ(x) ((int)(x).size())
#define ALL(v) (v).begin(), (v).end()
#define foreach(i, v) for (__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define reveach(i, v) for (__typeof((v).rbegin()) i = (v).rbegin(); i != (v).rend(); ++ i)
#define REP(i,a,n) for ( int i=a; i<int(n); i++ )
#define FOR(i,a,n) for ( int i=n-1; i>= int(a);i-- )
#define lson rt<<1, L, m
#define rson rt<<1|1, m, R
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
#define fi first
#define se second
#define CLR(a, b) memset(a, b, sizeof(a))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
const int N = 58;
const int M = 3e3 + 7;
int n;
int A;
int a[N];
ll dp[N][M];
int main(){
#ifdef ac
freopen("in.txt","r",stdin);
#endif
//freopen("out.txt","w",stdout);
scanf("%d%d", &n, &A);
REP(i, 0, n) scanf("%d", &a[i]);
dp[0][0] = 1;
REP(i, 0, n){
//printf("i = %d\n", i);
FOR(j, 1, n + 1){
//printf("j = %d\n", j);
FOR(k, a[i], M){
//printf("k = %d\n", k);
dp[j][k] += dp[j - 1][k - a[i]];
//printf("dp[j][k] = %lld\n", dp[j][k]);
}
}
}
ll res = 0;
REP(j, 1, n + 1){
res += dp[j][j * A];
}
printf("%lld\n", res);
return 0;
}
```

#### Submission Info

Submission Time 2016-08-28 21:19:53+0900 C - Tak and Cards Cosss C++14 (GCC 5.4.1) 300 1751 Byte AC 21 ms 1408 KB

#### Compile Error

```./Main.cpp: In function ‘int main()’:
./Main.cpp:47:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &n, &A);
^
./Main.cpp:48:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
REP(i, 0, n) scanf("%d", &a[i]);
^
```

#### Judge Result

Score / Max Score 0 / 0 200 / 200 100 / 100
Status
 AC × 4
 AC × 12
 AC × 24
Set Name Test Cases
Sample example_01.txt, example_02.txt, example_03.txt, example_04.txt
Case Name Status Exec Time Memory
example_01.txt AC 4 ms 384 KB
example_02.txt AC 4 ms 256 KB
example_03.txt AC 5 ms 384 KB
example_04.txt AC 11 ms 1024 KB
subtask1_01.txt AC 6 ms 640 KB
subtask1_02.txt AC 6 ms 640 KB
subtask1_03.txt AC 6 ms 640 KB
subtask1_04.txt AC 6 ms 640 KB
subtask1_05.txt AC 6 ms 640 KB
subtask1_06.txt AC 4 ms 256 KB
subtask1_07.txt AC 4 ms 256 KB
subtask1_08.txt AC 6 ms 640 KB
subtask1_09.txt AC 6 ms 640 KB
subtask2_01.txt AC 19 ms 1408 KB
subtask2_02.txt AC 19 ms 1408 KB
subtask2_03.txt AC 19 ms 1408 KB
subtask2_04.txt AC 20 ms 1408 KB
subtask2_05.txt AC 21 ms 1408 KB
subtask2_06.txt AC 19 ms 1408 KB
subtask2_07.txt AC 20 ms 1408 KB
subtask2_08.txt AC 11 ms 1024 KB
subtask2_09.txt AC 12 ms 1024 KB
subtask2_10.txt AC 14 ms 1152 KB
subtask2_11.txt AC 15 ms 1280 KB