题目地址:点击打开链接
C++代码:
#include <iostream>
#include <map>
#include <utility>
using namespace std;
int main()
{
int T;
while(cin>>T)
{
while(T--)
{
map<int,int> mii;
int N,P;
cin>>N>>P;
int i;
for(i=0;i<P;++i)
{
int x;
cin>>x;
int temp=x;
while(temp<=N)
{
if(temp%7!=6&&temp%7!=0)
mii.insert(make_pair(temp,1));
temp+=x;
}
}
cout<<mii.size()<<endl;
}
}
return 0;
}