Cod sursa(job #1294837)
| Utilizator | Data | 18 decembrie 2014 11:55:21 | |
|---|---|---|---|
| Problema | Fractii | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.67 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
long a, n=0, c=1;
ifstream in;
in.open("fractii.in");
in>>a;
in.close();
for(long i=1;i<=a;i++)
{
for(long j=1;j<=a;j++)
{
for(int x=1;x<=i || x<=j;x++)
{
if(j%x==0 && i%x==0 && !(x>i) && !(x>j))
{
c=x;
}
}
if(c==1)
{
n++;
}
c=1;
}
c=1;
}
ofstream out;
out.open("fractii.out");
out<<n;
out.close();
return 0;
}
