Cod sursa(job #980049)
| Utilizator | Data | 3 august 2013 19:58:48 | |
|---|---|---|---|
| Problema | Pascal | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("pascal.in");
ofstream out("pascal.out");
unsigned long long r,k=0,y;
short d;
unsigned long long rec(unsigned long long x){
if (x==1) return 1;
else return x*rec(x-1);
}
int main()
{
in >> r >> d;
y=rec(r);
for (unsigned long long i=1; i<=r-1; i++)
if ((rec(i)/(y*rec(r-i)))%d==0) k++;
out << k;
return 0;
}
