Cod sursa(job #53465)
| Utilizator | Data | 22 aprilie 2007 11:11:07 | |
|---|---|---|---|
| Problema | Oite | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <stdio.h>
#define cmax 1024
#define lmax 1000001
int c,l,tot,i,j;
int a[cmax],hs[lmax];
int main() {
freopen("oite.in","r",stdin);
freopen("oite.out","w",stdout);
scanf("%d%d",&c,&l);
for(i = 0; i < c; i++) scanf("%d",&a[i]);
for(i = 0; i < c; i++) {
for(j = i + 1; j < c; j++)
tot += hs[l - (a[i] + a[j])];
for(j = 0; j < i; j++)
hs[a[i] + a[j]]++;
}
printf("%d\n",tot);
return 0;
}
