Count the Holidays Solution || Codechef Starters - 28

         

Count the Holidays Solution 

Codechef Starters - 28
Problem Code : SUNDAY

Solution :

#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
using namespace std;

void solve()
{
    ll n;
    cin >> n;
    ll holiday = 8;
    for (ll i = 0; i < n; i++)
    {
        ll day;
        cin >> day;
        if (day != 7 && day != 14 && day != 21 && day != 28 &&
            day != 6 && day != 13 && day != 20 && day != 27)
        {
            holiday++;
        }
    }
    cout << holiday << "\n";
}

int main()
{
    ll t;
    cin >> t;
    while (t--)
    {
        solve();
    }
}

Comments