Pagini recente » Cod sursa (job #278437) | Cod sursa (job #3137841) | Cod sursa (job #991835) | Cod sursa (job #1624320) | Cod sursa (job #3155099)
#include<bits/stdc++.h>
using namespace std;
const int mod = 3000017;
int n, d, sp[3][5000002];
int ratie[3] = {2, 3, 5};
int mat[7][3] = {
0, 0, 0,
0, 0, 0,
1, 0, 0,
0, 1, 0,
2, 1, 0,
0, 0, 1,
0, 1, 1
};
int main()
{
ifstream cin("pascal.in");
ofstream cout("pascal.out");
cin >> n >> d;
for(int j = 0; j <= 2; j++)
{
for(int i = ratie[j]; i <= n; i += ratie[j])
sp[j][i] = sp[j][i / ratie[j]] + 1;
for(int i = ratie[j]; i <= n; i++)
sp[j][i] += sp[j][i-1];
}
int ans = 0;
for(int i = 0; i <= n; i++)
{
bool ok = 1;
for(int j = 0; j <= 2; j++)
if(sp[j][n] - sp[j][n-i] - sp[j][i] < mat[d][j])
ok = 0;
if(ok)
ans++;
}
cout << ans;
return 0;
}