Cod sursa(job #48250)

Utilizator RobytzzaIonescu Robert Marius Robytzza Data 4 aprilie 2007 15:50:26
Problema Fractii Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.65 kb
#include<fstream.h>
unsigned int a[60000];
int main(){
ifstream fin("fractii.in");
ofstream fout("fractii.out");
long N;
fin>>N;
long nr=N;
for (unsigned int i=2;i<=N;i++){
for (unsigned int t=0;t<=N;t++)
    a[t]=0;
	  unsigned int x=i;
	  while (x%2==0){
		a[2]=1;
		x/=2;}
	      for (unsigned int h=3;h<=N;h+=2)
		   while (x%h==0){
			 a[h]=1;
			 x/=h;}
	    nr++;
	    for (unsigned int e=2;e<=N;e++) {
		short ok=1;
		for (unsigned int s=1;s<N;s++)
		    if (e%s==0)
			ok=0;
		    else
		       if (s%e==0)
			   ok=0;
		if (ok==1)
		   nr++;}
	 }
	 if (N%2==1)
	   nr--;
fout<<nr;
fin.close();
fout.close();
return 0;}