K3CNTB-Editorial

PROBLEM LINK:

Practice
Contest

Author: Lakshay Kumar
Editorialist: Anugya Jain

DIFFICULTY:

CAKEWALK

PREREQUISITES:

Basic programming knowledge

PROBLEM:

Chef has an array A of length N and integer K. Calculate the total number of elements in array A greater than or equal to K.

EXPLANATION:

using a variable store the count of element greater than or equal to k.

SOLUTIONS:

Editorialist's Solution
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    vector<int>v(n,0);
    int count=0;
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
        if(v[i]>=k)count++;
    }
    cout<<count;
}