Uva 10050
#include<iostream> #include<cstring> using namespace std; int main() { int sum; cin>>sum; while(sum--) { int n,p; cin>>n; cin.ignore(); cin>>p; cin.ignore(); int i,j,a[3660]; memset(a,0,sizeof(a)); int temp,lose=0; for(i=0;i<p;i++) { cin>>temp; cin.ignore(); for(j=1;j<=n;j++) { if(j%temp==0)a[j]=1; } } for(i=1;i<=n;i++) { if((i%7!=6)&&(i%7!=0)&&(a[i]==1)) lose++; } cout<<lose<<endl; } return 0; }