Mai intai trebuie sa te autentifici.
Cod sursa(job #448134)
Utilizator | Data | 2 mai 2010 20:30:50 | |
---|---|---|---|
Problema | Pascal | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include <math.h>
#include <stdio.h>
int main ()
{freopen("pascal.in","r",stdin);
freopen("pascal.out","w",stdout);
int i,j,n,p,d,t,ct;
scanf("%d %d",&n,&d);
for (i=1,p=1;i<d;i++)
{ct=0;
t=n;
while(t)
{if((t%d)==i)
{ct++;
}
t/=d;
}
p*=pow(i+1,ct);
}
printf("%d",n-p+1);
return 0;
}