题意:
求1 - s 中 找出k个数 使它们的gcd > 1 求这样的k个数的对数
解析:
从每个素数的倍数中取k个数 求方案数
然后素数组合,容斥一下重的 奇加偶减
莫比乌斯函数的直接套模板就好了 容斥函数为 mu[i] * -1
#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <map>
#include <cctype>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#define rap(i, a, n) for(int i=a; i<=n; i++)
#define rep(i, a, n) for(int i=a; i<n; i++)
#define lap(i, a, n) for(int i=n; i>=a; i--)
#define lep(i, a, n) for(int i=n; i>a; i--)
#define rd(a) scanf("%d", &a)
#define rlld(a) scanf("%lld", &a)
#define rc(a) scanf("%c", &a)
#define rs(a) scanf("%s", a)
#define rb(a) scanf("%lf", &a)
#define rf(a) scanf("%f", &a)
#define pd(a) printf("%d\n", a)
#define plld(a) printf("%lld\n", a)
#define pc(a) printf("%c\n", a)
#define ps(a) printf("%s\n", a)
#define MOD 2018
#define LL long long
#define ULL unsigned long long
#define Pair pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define _ ios_base::sync_with_stdio(0),cin.tie(0)
//freopen("1.txt", "r", stdin);
using namespace std;
const int maxn = , INF = 0x7fffffff;
LL c[maxn][maxn];
int prime[maxn + ];
int cnt, s, k;
void get_prime()
{
mem(prime, );
for(int i=; i<=maxn; i++)
{
if(!prime[i]) prime[++prime[]] = i;
for(int j=; j<=prime[] && prime[j] <= maxn/i; j++)
{
prime[prime[j]*i] = ;
if(i % prime[j] == ) break;
}
}
} void init()
{
mem(c, );
c[][] = c[][] = ;
for(int i = ; i < maxn; i++)
{
c[i][] = ;
for(int j = ; j <= i; j++)
c[i][j] = c[i - ][j] + c[i - ][j - ];
}
} LL get_cnt()
{
LL res = ;
for(int i = ; i < ( << cnt); i++)
{
LL tmp = , ans2 = ;
for(int j = ; j <= cnt; j++)
{
if(((i >> (j - )) & ) == ) continue;
tmp *= prime[j];
ans2++;
}
// cout << tmp << endl;
// if(s / tmp < k) continue;
if(ans2 & ) res += c[s / tmp][k];
else res -= c[s / tmp][k];
}
return res;
} int main()
{
init();
get_prime();
while(cin >> k >> s)
{
LL res = ;
cnt = ;
for(int i = ; i < ; i++)
{
if(s / prime[i] < k) break;
cnt++;
}
LL ans = get_cnt();
if(ans > ) ans = ;
cout << ans << endl; } return ;
}