Help me !
Hey world , I need your help !
I am trying to solve this problem but I fail again and again in test cases. : -((
I think I am not getting this question in a better way.
Please help me to understand and to solve this problem.
I will be a great pleasure.
Link - Kill Monsters (Easy Version) Practice Coding Problem
My code
#include <bits/stdc++.h>
using namespace std;
// I know this code is incorrect please help me .
int main() {
// your code goes here
int t; cin>>t;
while(t--){
int N, X, K; int count = 0;
cin>>N>>X>>K;
int H[N];
for(int i = 0; i<N; i++){
cin>>H[i];
}
sort(H , H + N);
for(int i =0; i<N; i++){
if(K*X > H[N - i]){
X = H[N - i];
count = N - i + 1 ;
break;
}
}
cout<<count<<endl;
}
}
Problem Link: Kill Monsters (Easy Version) Practice Coding Problem