File size: 617 Bytes
c4b0eef |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
/*
>>~~ UVa Online Judge ACM Problem Solution ~~<<
ID: 10050
Name: Hartals
Problem: https://onlinejudge.org/external/100/10050.pdf
Language: C++
Author: Arash Shakery
Email: [email protected]
*/
#include <iostream>
using namespace std;
int main()
{
bool days[3651];
int t,k,n,p,i,j,count;
cin>>t;
while(t--){
int n;
cin>>n;
for(i=1;i<=n;i++)days[i]=0;
int p;
cin>>p;
for(i=0;i<p;i++){
cin>>k;
for(j=k;j<=n;j+=k)days[j]=true;
}
count=0;
for(i=1;i<=n;i++)if(i%7==6)i++;else if(days[i])count++;
cout<<count<<endl;
}
return 0;
}
|