Problem - 1

Problem --

A particular month has 30 days, numbered from 1 to 30.

Day 1 is a Monday, and the usual 7-day week is followed.
So day 2 is Tuesday, day 3 is Wednesday, and so on.

Every Saturday and Sunday is a holiday.

There are N festival days, which are also holidays.
Note - that a festival day can occur on a Saturday or Sunday.

Given the dates of the festivals. Determine the total number of holidays in this month.

Code --

// I have written this code, but it's not working. I can't figure the problem out. Please help me.

#include <bits/stdc++.h>

using namespace std;

int main()

{

int t;

cin >> t;

while(t--)

{

int N;

cin >> N;

int A[N],total_sat_sun =0, total_holiday=0;

for(int i=0; i < N; i++) { cin >> A[i]; }

for(int i =1; i<=30; i++) // counting total saturday & sunday

{

if(i%7 == 0 || i%7 == 6) // checking if it's sunday

{ total_sat_sun+=1; }

}

sort(A, A+N); //sorting the festival days

total_holiday+=total_sat_sun; //Sundays and Saturdays are also holidays

for(int j=0; j<N; j++)

{

if(A[j]%7 != 0 || A[j]%7 != 6) total_holiday++; //checking if the festival day is Saturday/sunday

}

cout<<total_holiday<<endl;

}

return 0;

}