Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. #define int long long
  6. #define double long double
  7. #define pb push_back
  8. #define mp make_pair
  9. #define all(a) a.begin(), a.end()
  10. #define rall(a) a.rbegin(), a.rend()
  11. #define endl '\n'
  12.  
  13. int cnt(int n) {
  14.     int ans = 0;
  15.     while (n) {
  16.         ++ans, n /= 10;
  17.     }
  18.     return ans;
  19. }
  20.  
  21. signed main() {
  22.     ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  23.     cout << fixed << setprecision(20);
  24. #ifdef _DEBUG
  25.     freopen("input.txt", "r", stdin);
  26.     freopen("output.txt", "w", stdout);
  27. #endif
  28.     int n, k, t;
  29.     cin >> n >> k >> t;
  30.     vector<int> a(n);
  31.     vector<int> pref(n + 1, 0);
  32.     for (auto& i : a) {
  33.         int x, y; char c;
  34.         cin >> x >> c >> y;
  35.         i = x * y;
  36.     }
  37.     sort(all(a)); for (int i = 0; i < n; ++i) pref[i + 1] = pref[i] + a[i];
  38.  
  39.     if (k > 1e11 || t > 1e11 || cnt(k) + cnt(t) >= 15) {
  40.         cout << n; return 0;
  41.     }
  42.     const double eps = 1e-9;
  43.     int ans = 0;
  44.     for (int i = 0; i <= n; ++i) {
  45.         if ((double)t - 1.0 * pref[i] / k > eps) {
  46.             ans = max(ans, i);
  47.         }
  48.     }
  49.     cout << ans;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement