SHARE
TWEET

Untitled

a guest Oct 20th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     double a, b, c;
  8.     cin >> a >> b >> c;
  9.     if(b == 0 && c == 0){
  10.         cout << 0;
  11.         return 0;
  12.     }
  13.     else if(c == 0){
  14.         cout << a;
  15.         return 0;
  16.     }
  17.     else if(b == 0){
  18.         cout << 0;
  19.         return 0;
  20.     }
  21.     vector <double> v;
  22.     for(int i = 0; i < a; i++){
  23.         double x, y;
  24.         char c;
  25.         cin >> x >> c >> y;
  26.         double u = x * y;
  27.         v.push_back(u);
  28.     }
  29.     double cnt = 0;
  30.     sort(v.begin(), v.end());
  31.     double t = b * c;
  32.     for(int i = 0; i < v.size(); i++){
  33.         double r = v[i];
  34.         if(t - r > 0){
  35.             t -= r;
  36.             cnt++;
  37.         }
  38.     }
  39.     cout << cnt;
  40.     return 0;
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top