Cod sursa(job #25215)

Utilizator andytrAlexandru Traista andytr Data 4 martie 2007 11:27:27
Problema Puteri Scor 0
Compilator cpp Status done
Runda preONI 2007, Runda 3, Clasa a 10-a Marime 0.56 kb
#include <stdio.h>
#define Dmax 100001

int cit()
{FILE *f=fopen("puteri.in","r");
int i,n,a[Dmax],b[Dmax],c[Dmax],j,nr=0;
int x,y,z;
fscanf(f,"%d",&n);
for(i=1;i<=n;i++)
 {fscanf(f,"%d %d %d",&a[i],&b[i],&c[i]);
  for(j=i-1;j>=1;j--)
   {x=a[i]+a[j];
    y=b[i]+b[j];
    z=c[i]+c[j];
    if(x==0&&y==z||y==0&&x==z||z==0&&x==y||x==0&&y==0||x==0&&z==0||y==0&&z==0||x==y&&y==z)
     nr++;
   }
 }
fclose(f);
return nr;
}

void scr(long x)
{FILE *f=fopen("puteri.out","w");
fprintf(f,"%ld",x);
fclose(f);
}

int main()
{scr(cit());
return 0;
}