Cod sursa(job #171178)
Utilizator | Data | 3 aprilie 2008 19:51:47 | |
---|---|---|---|
Problema | Pascal | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
# include <stdio.h>
long int x,y,r,d,k,i,z;
int main ()
{
freopen ("pascal.in","r",stdin);
freopen ("pascal.out","w",stdout);
scanf ("%li",&r);
scanf ("%li",&d);
k=0;
if (r%d==0)
k=k+2;
y=r;
for (i=2;i<=r/2;i++)
{
z=r-i+1;
x=(z*y)/i;
if (x%d==0)
k=k+2;
y=x;
}
if (r%2==0)
if (y%d==0)
k--;
printf ("%li",k);
return 0;
}