# TODOLIST - Editorial

Setter: Hrishikesh
Tester: Harris Leung
Editorialist: Trung Dang

580

None

# PROBLEM:

Chef is a beginner and should ideally try and solve only problems with difficulty rating strictly less than 1000. Given a list of difficulty ratings for problems in the Chef’s to-do list, please help him identify how many of those problems Chef should remove from his to-do list, so that he is only left with problems of difficulty rating less than 1000.

# EXPLANATION:

We loop through the list of difficulty ratings and count the number of problems that are at least 1000 in rating.

# TIME COMPLEXITY:

Time complexity is O(N) per test case.

# SOLUTION:

Preparer's Solution
``````#include<iostream>

using namespace std;

int q,n,a;

int main()
{
cin>>q;

while(q--)
{
cin>>n;
int cnt = 0;
for(int i=1;i<=n;i++)
{
cin>>a;
if(a >= 1000)
cnt++;
}
cout<<cnt<<"\n";
}
}
``````
Tester's Solution
``````#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
ll n;
void solve(int rr){
cin >> n;
int ans=0;
for(int i=1; i<=n ;i++){
int x;cin >> x;ans+=(x>=1000);
}
cout << ans << '\n';
}
int main(){
ios::sync_with_stdio(false);cin.tie(0);
int t;cin >> t;
for(int i=1; i<=t ;i++) solve(i);
}
``````
Editorialist's Solution
``````#include <bits/stdc++.h>
using namespace std;

int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t; cin >> t;
while (t--) {
int n; cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
cout << count_if(a.begin(), a.end(), [](int u) { return u >= 1000; }) << '\n';
}
}
``````