-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10050.cpp
45 lines (42 loc) · 1016 Bytes
/
10050.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int cases,p,h,ans,n,lose,a,i,fri,j;
int A[10000];
int main(){
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
scanf("%d",&cases);
while(cases--){
for(i=1;i<=3650;i++)A[i]=0;
for(i=6,j=7;i<=3650;i=i+7,j=j+7){
A[i]=1;
A[j]=1;
}
ans=0;
lose=0;
scanf("%d",&n);
scanf("%d",&p);
for(i=1;i<=p;i++){
scanf("%d",&a);
ans=0;
while(ans<=n){
ans=ans+a;
//printf("ekhon ans %d\n",ans);
if(A[ans]==0){
A[ans]=-1;
}
}
}
for(i=1;i<=n;i++){
if(A[i]==-1){
//printf("i===%d\n",i);
lose++;
}
}
printf("%d\n",lose);
}
}