uva 10050 - Hartals
#include <stdio.h> int main() { int t,i,j,n,m,h,sum,a[4000]; scanf("%d",&t); while (t--) { scanf("%d",&n); for (i=1;i<=n;i++) a[i]=0; sum=0; scanf("%d",&m); for (i=1;i<=m;i++) {scanf("%d",&h); for (j=1;j*h<=n;j++) a[j*h]=1; } for (i=0;7*i<=n;i++) {a[7*i]=0;a[7*i+6]=0;} for (i=1;i<=n;i++) sum+=a[i]; printf("%d\n",sum); } return 0; }