Cod sursa(job #2232315)

Utilizator AlexPascu007Pascu Ionut Alexandru AlexPascu007 Data 18 august 2018 16:10:53
Problema Pascal Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.3 kb
#include <fstream>
using namespace std;
ifstream fin("pascal.in");
ofstream fout("pascal.out");
int r,d,i,j,cnt,m;
double s=1;
int main() {
	fin>>r>>d;
	for (j=1;j<=r;j++) {
		s=1;
		for (i=j+1;i<=r;i++)
			s=s*i/(r-i);
		m=int(s);
		if (m%d==0)
			cnt++;
	}
	fout<<cnt;
	return 0;
}