Codeforces Educational Codeforces Round 91 (Rated for Div. 2) 1380C. Create The Teams Solution

  


Problem Link : https://codeforces.com/contest/1380/problem/C

  1. /// Author : AH_Tonmoy
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. int32_t main() {
  5. ios_base::sync_with_stdio(0);
  6. cin.tie(0);
  7. int t;
  8. cin >> t;
  9. while (t--) {
  10. int n , x ;
  11. cin >> n >> x ;
  12. std::vector<int>a(n);
  13. for ( int i = 0 ; i < n ; i++){
  14. cin >> a[i] ;
  15. }
  16. sort(a.rbegin(),a.rend()) ;
  17. int ans = 0 , index_cnt = 0;
  18. for ( int i = 0 ; i < n ; i++){
  19. index_cnt++ ;
  20. if ( index_cnt * a[i] >= x){
  21. ans++ ;
  22. index_cnt = 0 ;
  23. }
  24. }
  25. cout << ans <<'\n';
  26. }
  27. return 0 ;
  28. }

No comments

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.