Cod sursa(job #27763)

Utilizator dj_vladootzCostica Vlad dj_vladootz Data 7 martie 2007 08:39:24
Problema Zero 2 Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include<fstream.h>
int main()
{
unsigned long int n,b,i,j,a,p=1,z;
ifstream f("zero2.in");
ofstream g("zero2.out");
a=1;
while(a<=10)
	{
	f>>n>>b;
	p=1;
	i=1;
	while(i<=n)
		{
		j=1;
		while(j<=i)
			{
 			p=p*j;
			j++;
			}
		i++
		}
	z=0;
	while(p!=0&&p%b==0)
		{
		z++;
		p=p/b;
		}
	g<<z<<'\n';
        a++;
	}
return 0;
}