-
Notifications
You must be signed in to change notification settings - Fork 14
/
10050.cpp
32 lines (32 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
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
int test;
scanf("%d",&test);
while(test--){
int n,p,i,j;
scanf("%d",&n);
int day[3651]={0};
scanf("%d",&p);
for(i=1;i<=p;i++){
int hpar;
scanf("%d",&hpar);
for(j=hpar;j<=n;j+=hpar)
day[j]=1;
}
for(i=6;i<=n;i+=7){
day[i]=0;
day[i+1]=0;
}
int cnt=0;
for(i=1;i<=n;i++){
if(day[i]==1)
cnt++;
}
printf("%d\n",cnt);
}
return 0;
}