题目链接:能被整除的数

#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int N = 20;
int n, m;
int p[N];
int main()
{
cin >> n >> m;
for(int i = 0; i < m; i++) cin >> p[i];
int res = 0;
for(int i = 1; i < 1 << m; i++)
{
int t = 1, cnt = 0;
for(int j = 0; j < m; j++)
if(i >> j & 1)
{
cnt ++;
if((LL) t * p[j] > n)
{
t = -1;
break;
}
t *= p[j];
}
if(t != -1){
if(cnt % 2) res += n / t;
else res -= n / t;
}
}
cout << res << endl;
return 0;
}





![[管理与领导-81]:IT基层管理者 - 核心技能 - 高效执行力 - 6- 两大思维:服务思维、重点思维、高效与快速的区别?](https://img-blog.csdnimg.cn/5454cce8f8ae4c0f9848162206b60f4a.png)













