Cod sursa(job #25223)

Utilizator marius_902002Cocis Marius Gabriel marius_902002 Data 4 martie 2007 11:29:05
Problema Puteri Scor 0
Compilator cpp Status done
Runda preONI 2007, Runda 3, Clasa a 9-a si gimnaziu Marime 0.69 kb
#include<stdio.h>

int a[10001][4],n,i,z,nr,j,max,x[4];

int main(){

freopen("puteri.in","r",stdin);
freopen("puteri.out","w",stdout);

scanf("%d",&n);
for(i=1;i<=n;i++)
	scanf("%d%d%d",&a[i][1],&a[i][2],&a[i][3]);

for(i=1;i<n;i++){
	for(j=i+1;j<=n;j++)
	{
		z=0;
		max=0;
		x[1]=a[i][1]+a[j][1];
		if(!x[1]) z++;
		if(x[1]>max)
			max=x[1];
		x[2]=a[i][2]+a[j][2];
		if(!x[2]) z++;
		if(x[2]>max)
			max=x[2];
		x[3]=a[i][3]+a[j][3];
		if(!x[3]) z++;
		if(x[3]>max)
			max=x[3];
		if(max>1)
			if(!x[1]||x[1]==max||x[1]==max/2&&z<1)
				if(!x[2]||x[2]==max||x[2]==max/2&&z<1)
					if(!x[3]||x[3]==max||x[3]==max/2&&z<1)
						nr++;
	}
}
printf("%d",nr);

return 0;

}