Cod sursa(job #470572)

Utilizator andrei.dAndrei Diaconeasa andrei.d Data 14 iulie 2010 17:22:57
Problema Mins Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <cstdio>

#define file_in "mins.in"
#define file_out "mins.out"

int a,b;
void citire()
{
	freopen(file_in,"r",stdin);
	freopen(file_out,"w",stdout);
	
	scanf("%d %d", &a, &b);
}	

inline int cmmdc(int a, int b)
{
	int r;
	
	while(b)
	{
		r=a%b;
		a=b;
		b=r;
	}
	
	return a;
}


void solve()
{
	int i,j,nr=0;
    for (i=1;i<a;++i)
		 for (j=1;j<b;++j)
			  if (cmmdc(i,j)==1)
				  nr++;
			  printf("%d\n", nr);
		 

}

int main()
{
	citire();
	solve();
	
	fclose(stdin);
	fclose(stdout);
	
	return 0;
	
}