Cod sursa(job #211967)

Utilizator upperclasstrashToma Bogdan upperclasstrash Data 3 octombrie 2008 22:59:18
Problema Fractii Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.34 kb
#include<iostream.h>
#include<fstream.h>
ifstream f("fractii.in");
ofstream g("fractii.out");
int n,i,j,s,x,y,k,s2;
int main()
{f>>n;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
 if(j==1 || i==1)
  s++;
  else
   { x=i;y=j;
   do
   if(x>y)
   x=x-y;
   else
   y=y-x;
   while(x!=y);
   if(x==1 || y==1)
   s++; }
g<<s;
  f.close();
g.close();
return 0;}