Cod sursa(job #640350)
Utilizator | Data | 25 noiembrie 2011 15:20:23 | |
---|---|---|---|
Problema | Medie | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <cstdio>
int f[9005],n;
int main () {
freopen("medie.in","r",stdin);
freopen("medie.out","w",stdout);
int i,j,k,co=0;
scanf("%d",&n);
for(i=1;i<=n;++i){
scanf("%d",&f[i]);
}
for(i=1;i<=n;++i){
for(j=1;j<=n;++j){
for(k=1;k<=n;++k){
if((k!=j)&&(j!=i)&&(k!=i)&&(f[i]==(f[j]+f[k])/2)){
co++;
}
}
}
}
printf("%d",co/2);
}