Advertisement
ShafiulAzim

uva 10050

Feb 11th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int h[102],td,p,t,hartal,i,j;
  6. cin>>t;
  7. while(t--)
  8. {
  9. cin>>td>>p;
  10. hartal=0;
  11. int ans[td];
  12. for(i=0; i<p; i++)
  13. {
  14. cin>>h[i];
  15. }
  16. for(i=0; i<td; i++)
  17. {
  18. ans[i]=0;
  19. }
  20. j=p;
  21. while(j--)
  22. {
  23. for(i=1; i<=td; i++)
  24. {
  25. if((i%h[j]==0) && (i%7!=0) && (i%7!=6))
  26. {
  27. ans[i-1]=1;
  28. }
  29.  
  30. }
  31. }
  32. for(i=0; i<td; i++)
  33. {
  34. if(ans[i]==1)
  35. hartal++;
  36. }
  37. cout<<hartal<<endl;
  38.  
  39. }
  40. return 0;
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement