-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuva-10050.c
More file actions
45 lines (40 loc) · 1.04 KB
/
uva-10050.c
File metadata and controls
45 lines (40 loc) · 1.04 KB
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 <stdio.h>
#include <stdlib.h>
int main()
{
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
int test, n, i, j, p, count, *h;
char *days;
scanf("%d", &test);
while (test--) {
scanf("%d", &n);
days = (char *) malloc((n + 1) * sizeof(char));
for (i = 1; i <= n; i++) {
days[i] = 'w';
}
scanf("%d", &p);
h = (int *) malloc(p * sizeof(int));
for (i = 0; i < p; i++) {
scanf("%d", &h[i]);
}
count = 0;
for (i = 1; i <= n; i++) {
for (j = 0; j < p; j++) {
if (i % 7 != 0 && (i + 1) % 7 != 0) {
if (i % h[j] == 0) {
days[i] = 'x';
//count++;
}
}
}
}
for (i = 1; i <= n; i++) {
if (days[i] == 'x') {
count++;
}
}
printf("%d\n", count);
}
return 0;
}