Cod sursa(job #25606)

Utilizator rinfoPopescu Razvan rinfo Data 4 martie 2007 13:07:31
Problema Puteri Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.69 kb
#include<fstream.h>
typedef struct chr{int a,b,c;}; chr v[10000];
int x,y,z;
void sortare(){
int aux;
if(x<y) {aux=x; x=y; y=aux;}
if(y<z) {aux=y; y=z; z=aux;}
if(x<y) {aux=x; x=y; y=aux;}
}

int main(){
unsigned int n;
int s=0;
ifstream f("puteri.in");
ofstream g("puteri.out");

f>>n;

for(int i=0; i<n; i++)
f>>v[i].a>>v[i].b>>v[i].c;
f.close();

int m;

for(i=0; i<n; i++)
for(int j=i+1; j<n; j++){
m=0;
x=v[i].a+v[j].a;
y=v[i].b+v[j].b;
z=v[i].c+v[j].c;

sortare();

if(y!=0) {if((x%y)==0) {if((x==1)||(y==1)) m=1; }
	       else m=1; }

if(z!=0) {if((y%z)==0) {if((y==1)||(z==1)) m=1;}
	       else m=1; }

if(m==0) s++;
}

g<<s;
g.close();

return 0;}