Time Exceeded
代码
#include<iostream>
#include<cstdio>
using namespace std;
int n,m,ans=0;
int a[21];
int main()
{//freopen("count.in","r",stdin);
//freopen("count.out","w",stdout);
cin>>n>>m;
ans=n;
for(int i=1;i<=m;i++)
cin>>a[i];
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
{if(a[j]>n)break;
if(i%a[j]==0)
{ans--;break;
}
}
cout<<ans;
return 0;
}