#include<cstdio> using namespace std; int main() { int t; scanf("%d",&t); while (t--) { int n,q,p,r,count; scanf("%d",&n); int a[n+1]={0}; scanf("%d",&p); count=0; while (p--) { scanf("%d",&q); for (int i=q;i<=n;i+=q) { r=i%7; if (a[i]==0 && r!=0 && r!=6) { count++; a[i]=1; } } } printf("%d\n",count); } return 0; }
Wednesday, June 8, 2016
UVA 10050 : Hartals - solution
Unknown
Studying at Shahjalal University of Science and Technology, Sylhet.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment