Cod sursa(job #268554)
Utilizator | Data | 1 martie 2009 13:52:12 | |
---|---|---|---|
Problema | Fractii | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include<fstream>
using namespace std;
int main()
{
ifstream in("fractii.in");
ofstream out("fractii.out");
int n,i,j,x,ok,l=0;
in>>n;
for (i=2;i<=n;i++)
for (j=2;j<=n;j++)
{ok=0;
for (x=2;x<=j;x++)
if (i%x==0 && j%x==0) ok++;
if (ok==0) l++;}
out<<l+n+n-1;
in.close();
out.close();
return 0;
}