Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t,n,np,i,p,c,x,j;
- cin>>t;
- while(t--)
- {
- c=0;
- cin>>n>>np;
- int arr[n];
- for(i=0; i<n; i++)
- {
- arr[i]=0;
- }
- for(j=0;j<np;j++)
- {
- x=0;
- cin>>p;
- for(i=1; ; i++)
- {
- x=(p*i);
- if(x>n)
- break;
- else if(x%7!=0 && x%7!=6)
- {
- arr[x-1]=1;
- }
- }
- }
- for(i=0; i<n; i++)
- {
- if(arr[i]==1)
- c++;
- }
- cout<<c<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement