ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#188284 | #3316. 平均(average) | ddh123 | 100 | 13ms | 1876kb | C++11 | 390b | 2023-10-03 08:04:59 | 2023-10-03 12:47:00 |
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,x,a[55],ans;
unordered_map<int,int>dp[55];
signed main(){
cin>>n>>x;
for(int i=1;i<=n;i++)
cin>>a[i],a[i]-=x,dp[i][a[i]]++;
for(int i=1;i<n;i++)
for(int j=i+1;j<=n;j++)
for(auto &&k:dp[i])
dp[j][a[j]+k.first]+=k.second;
for(int i=1;i<=n;i++)
ans+=dp[i][0];
cout<<ans;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1296kb
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: 1304kb
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: 0ms
memory: 1312kb
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: 1264kb
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: 0ms
memory: 1244kb
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: 1ms
memory: 1276kb
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: 4ms
memory: 1780kb
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: 2ms
memory: 1876kb
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: 3ms
memory: 1668kb
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: 3ms
memory: 1728kb
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