# Help me in solving AOCP10 problem

### My code

``````// Update the code below to solve the problem

#include <stdio.h>

int main() {
int t,count=8;
scanf("%d", &t);

for (int i = 0; i < t; i++) {
int n;
scanf("%d", &n);
int A[n];
for (int j = 0; j < n; j++) {
scanf("%d", &A[j]);
}

for(int j=0; j<n;j++){
if(A[j]==6 || A[j]==7 || A[j]==13 || A[j]==14 || A[j]==20 || A[j]==21 || A[j]==27 || A[j]==28)
continue;

else
count++;
}

printf("%d\n",count);
}
return 0;
}
``````

Learning course: C for problem solving - 2
Problem Link: CodeChef: Practical coding for everyone

Your code is incorrect because it does not reset the count variable to 8 after each iteration, for each case, there will be 8 holidays (due to sundays and saturdays) but your code doesnâ€™t take this into account, so for next case its taking the already incremented count value to be the new value rather than starting from 8.

``````#include <stdio.h>

int main() {
int t;
scanf("%d", &t);

while (t--) {
int count = 8; // Reset count for each test case
int n;
scanf("%d", &n);
int A[n];
for (int j = 0; j < n; j++) {
scanf("%d", &A[j]);
}

for(int j = 0; j < n; j++){
if(A[j] == 6 || A[j] == 7 || A[j] == 13 || A[j] == 14 || A[j] == 20 || A[j] == 21 || A[j] == 27 || A[j] == 28)
continue;
else
count++;
}

printf("%d\n", count);
}
return 0;
}

``````