Cod sursa(job #721674)

Utilizator 5t3fristea stefan 5t3f Data 23 martie 2012 23:14:12
Problema Puteri Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.64 kb
// puteri.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
#include "fstream"
using namespace std;
int main()
{
	ifstream f("puteri.in");
	ofstream g("puteri.out");
	int a[80000][3],n;
	int i;
	f>>n;
	for(i=0;i<n;i++)
		f>>a[i][0]>>a[i][1]>>a[i][2];
	int j;
	int sol=0;
	for(i=0;i<n;i++)
		for(j=i+1;j<n;j++)
		{
			int tmp1,tmp2,tmp3;
			tmp1=0;
			tmp2=0;
			tmp3=0;
			tmp1=a[i][0]+a[j][0];
			tmp2=a[i][1]+a[j][1];
			tmp3=a[i][2]+a[j][2];
			int l;
			for(l=2;l<=tmp1;l++)
				if((tmp1%l==0)&&(tmp2%l==0)&&(tmp3%l==0))
				{
					sol++;
					break;
				}
		}
	g<<sol;
	return 0;
}