-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10050.cpp
54 lines (34 loc) · 801 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
46
47
48
49
50
51
52
53
54
#include<bits/stdc++.h>
using namespace std;
int main()
{
//freopen("ifat.txt", "r", stdin);
long long t, day, pNum, p[120], ans, total, fri, sat;
cin >> t;
while(t--)
{
cin >> day;
cin >> pNum;
for(int i = 0; i < pNum; i++)
{
cin >> p[i];
}
total = 0;
for(int i = 1; i <= day; i++)
{
ans = 0;
if(i % 7 == 6 || i % 7 == 0)continue;
for(int j = 0; j < pNum; j++)
{
if(ans == 1) break;
if(i % p[j] == 0)
{
ans ++;
}
}
total = total + ans;
}
cout << total <<endl;
}
return 0;
}