Pagini recente » Borderou de evaluare (job #3317750) | Cod sursa (job #3333229) | Cod sursa (job #3323552) | Cod sursa (job #3344909) | Cod sursa (job #3330342)
#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];
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;
}