Blame view
SearchingSortingandBasicDataStructures/LinearSearch/Problem2/GeekandhisMarks.cpp
713 Bytes
743b077f4
![]() |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
// // Created by ronal on 2/11/2023. // Problem Description Link. // https://practice.geeksforgeeks.org/problems/geek-and-his-marks-1611824243/0 #include <iostream> #include <vector> using namespace std; int ValuesMorethanInput(vector<int> &v, int x){ int count = 0; for(auto &value : v){ if(value > x){ count++; } } return count; } int main() { vector<int> v; int n, x, tests, value; cin >> tests; for(int i = 0; i < tests; i++){ cin >> n >> x; for(int j = 0; j < n; j++){ cin >> value; v.push_back(value); } cout << ValuesMorethanInput(v, x) << " "; v.clear(); } return 0; } |