Cod sursa(job #243742)

Utilizator monkTemian Vlad monk Data 13 ianuarie 2009 22:07:05
Problema Fractii Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 kb
/*
    Nume:Temian
    Date:
    Problema:
*/
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    ifstream fin("fractii.in");
    ofstream fout("fractii.out");
    unsigned long int q,i,n,c=0,j,b;
    fin>>n;
    for(i=1;i<=n;i++)
    {
    				 for(q=1;q<=n;q++)
				{
	                   b=0;
                        for(j=2;j<=i/2;j++)
                           if(i%j==0&&q%j==0){b=1;break;}
                        if(b==0)c++;
		          }
                           
    }
    c-=(n-1);
    fout<<c;
    system ("pause");
    return 1;
}