Cod sursa(job #648426)

Utilizator FernandoSandoiu Fernando Fernando Data 13 decembrie 2011 14:42:12
Problema Fractii Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <fstream>
using namespace std;
int main()
{long i,j,N,p;
ifstream f("fractii.in");
ofstream h("fractii.out");
f>>N;p=0;
for(i=1;i<=N;i++)
  for(j=1;j<=N;j++)
   { if((i==1)||(j==1))
		p=p+1;
    if (i>=j)
		if ((i%j!=0)&&((i!=1)&&(j!=1)))
	  	   p=p+1;
	if (j>i)
   		if((j%i!=0)&&((i!=1)&&(j!=1)))
		   p=p+1;}
h<<p<<endl;
f.close();
h.close();
return 0;
}