# CBNK - Editorial

Contest

Author: Naman Singh

Tester: Rishab Agrawal

Editorialist: Sanchay Kedia

DIFFICULTY: Cakewalk

PREREQUISITES: Basic Maths

PROBLEM:
There is an int array N. You have to find the number of integers lying in N that don’t lie between integers A and B (both inclusive).

QUICK EXPLANATION:
If element in N is less than A or greater than B then we increment the count.

EXPLANATION:
There is an integer array N which contains the subject numbers that the chef has to study. There are two integers A and B that denote the range of the subject numbers that the chef doesn’t like studying.
Now we need to count the subjects whose numbers does not lie between A and B (including A and B).

For this we will make a loop for every element in the array and check if the chef will attend it or not.

CASES:

1. Subject number < A:
This subject period will be attended by the chef and here the count variable will be incremented.
2. Subject number >= A and <= B:
This subject period is to be bunked by the chef and thus here the variable count will not be incremented.
3. Subject number > B:
This subject period will be attended by the chef and therefore the variable count will be incremented.

# Setter’s Solution

Setter's Solution
``````#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
long long n,a,b;
cin>>n>>a>>b;
int arr[n];
int count=0;
for(int i=0;i<n;i++)
{
cin>>arr[i];
if(arr[i]<a || arr[i]>b)
{
count++;
}
}
cout<<count<<endl;
}
return 0;
}
``````
1 Like