Pagini recente » Cod sursa (job #3327052) | Cod sursa (job #3304102) | Cod sursa (job #3335749) | Monitorul de evaluare | Cod sursa (job #3330343)
#include <bits/stdc++.h>
/// Template Dutzu
#define fast ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
ifstream fin("oite.in");
ofstream fout("oite.out");
int v[1030];
unordered_map<long long,int> m;
int main()
{
fast
int n,l;
fin>>n>>l;
for (int i=1;i<=n;i++)
fin>>v[i];
long long rez=0;
for (int i=1;i<=n;i++){
for (int j=i+1;j<=n;j++)
rez+=m[l-v[i]-v[j]];
for (int j=1;j<i;j++)
m[v[i]+v[j]]++;
}
fout<<rez;
return 0;
}