Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- long long k,l,n,p,h[100],ans,found,j,t,i;
- scanf("%lld",&t);
- while(t--)
- {
- scanf("%lld%lld",&n,&p);
- for(j=0;j<p;j++)
- scanf("%lld",&h[j]);
- ans=0;
- for(i=1;i<=n;i++)
- {
- if(i%7==6||i%7==0)
- continue;
- found=0;
- for(k=0;k<p;k++)
- if(i%h[k]==0)
- found=1;
- if(found==1)
- ++ans;
- }
- printf("%lld\n",ans);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment