Cod sursa(job #571675)

Utilizator Sm3USmeu Rares Sm3U Data 4 aprilie 2011 18:00:24
Problema Medie Scor 100
Compilator cpp Status done
Runda brasov_11_jr Marime 0.52 kb
#include <stdio.h>
#define nmax 9010
#define vmax 7010

using namespace std;

int a[nmax];
int b[vmax*2];
int n;

int main()
{
    freopen("medie.in","r",stdin);
    freopen("medie.out","w",stdout);

    scanf("%d",&n);
    for(int i=0;i<n;++i)
    {
        scanf("%d",&a[i]);
        for(int j=i-1;j>=0;--j)
        {
            b[a[i]+a[j]]++;
        }
        b[a[i]<<1]--;
    }
    int s=0;
    for(int i=0;i<n;i++)
    {
        s+=b[a[i]<<1]+1;
    }
    printf("%d\n",s);

    return 0;
}