Pagini recente » Cod sursa (job #932823) | Cod sursa (job #413596) | Cod sursa (job #2322624) | Cod sursa (job #2424106) | Cod sursa (job #2672339)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("pascal.in");
ofstream fout("pascal.out");
int main() {
int N, D;
fin >> N >> D;
int ans = 0;
vector < int > e(7);
for(int i = 1; i <= N / 2; ++i) {
int x = i;
while(x % 2 == 0) {
x /= 2;
--e[2];
}
while(x % 3 == 0) {
x /= 3;
--e[3];
}
while(x % 5 == 0) {
x /= 5;
--e[5];
}
x = N - i + 1;
while(x % 2 == 0) {
x /= 2;
++e[2];
}
while(x % 3 == 0) {
x /= 3;
++e[3];
}
while(x % 5 == 0) {
x /= 5;
++e[5];
}
e[4] = e[2] / 2;
e[6] = min(e[2], e[3]);
if(e[D] > 0)
ans += 2;
}
if(N % 2 == 0 && e[D] > 0)
--ans;
fout << ans;
}