ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#188285 | #3316. 平均(average) | Harry27182 | 100 | 9ms | 1684kb | C++11 | 485b | 2023-10-03 08:07:27 | 2023-10-03 12:47:03 |
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int V=10000;
int dp[55][20005],n,m,a[55];
void Add(int &x,int y){x+=y;}
signed main()
{
cin.tie(0)->sync_with_stdio(0);
cin>>n>>m;
for(int i=1;i<=n;i++)cin>>a[i],a[i]-=m;
dp[0][V]=1;
for(int i=1;i<=n;i++)
{
for(int j=-V;j<=V;j++)
{
if(!dp[i-1][j+V])continue;
Add(dp[i][j+V],dp[i-1][j+V]);
Add(dp[i][j+V+a[i]],dp[i-1][j+V]);
}
}
cout<<dp[n][V]-1;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1320kb
input:
16 32 45 36 41 5 49 11 11 34 41 11 19 36 39 47 25 36
output:
756
result:
ok single line: '756'
Test #2:
score: 10
Accepted
time: 0ms
memory: 1324kb
input:
15 9 42 38 15 35 27 26 7 17 1 13 46 12 24 33 48
output:
2
result:
ok single line: '2'
Test #3:
score: 10
Accepted
time: 1ms
memory: 1324kb
input:
15 46 49 9 2 22 24 35 49 40 27 10 30 43 50 35 46
output:
7
result:
ok single line: '7'
Test #4:
score: 10
Accepted
time: 0ms
memory: 1312kb
input:
10 44 33 38 15 4 15 21 8 13 18 10
output:
0
result:
ok single line: '0'
Test #5:
score: 10
Accepted
time: 2ms
memory: 1452kb
input:
50 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
1125899906842623
result:
ok single line: '1125899906842623'
Test #6:
score: 10
Accepted
time: 2ms
memory: 1684kb
input:
50 1 50 50 1 1 1 50 1 50 50 50 50 50 1 1 1 1 50 1 1 50 50 50 50 1 1 1 1 1 1 1 1 1 50 50 1 1 50 50 1 ...
output:
33554431
result:
ok single line: '33554431'
Test #7:
score: 10
Accepted
time: 2ms
memory: 1524kb
input:
43 21 38 40 25 5 16 16 18 7 2 12 4 4 26 17 3 46 46 34 50 8 48 14 44 42 45 6 32 33 42 1 11 11 45 8 7 ...
output:
17632158863
result:
ok single line: '17632158863'
Test #8:
score: 10
Accepted
time: 0ms
memory: 1548kb
input:
41 10 40 36 34 17 29 46 12 10 16 47 36 25 8 11 30 15 50 48 30 25 10 34 39 2 45 27 48 36 44 34 34 12 ...
output:
267
result:
ok single line: '267'
Test #9:
score: 10
Accepted
time: 0ms
memory: 1476kb
input:
33 50 49 9 2 22 24 35 49 40 27 10 30 43 50 35 2 35 46 49 49 47 29 28 34 31 12 4 4 2 9 35 30 9 39
output:
1
result:
ok single line: '1'
Test #10:
score: 10
Accepted
time: 2ms
memory: 1476kb
input:
33 44 48 5 35 12 8 30 20 29 50 16 33 38 15 4 15 21 8 13 18 10 6 26 8 20 6 32 1 47 16 12 44 50 9
output:
15
result:
ok single line: '15'
Extra Test:
score: 0
Extra Test Passed