Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- #define double long double
- #define pb push_back
- #define mp make_pair
- #define all(a) a.begin(), a.end()
- #define rall(a) a.rbegin(), a.rend()
- #define endl '\n'
- int cnt(int n) {
- int ans = 0;
- while (n) {
- ++ans, n /= 10;
- }
- return ans;
- }
- signed main() {
- ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
- cout << fixed << setprecision(20);
- #ifdef _DEBUG
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- int n, k, t;
- cin >> n >> k >> t;
- vector<int> a(n);
- vector<int> pref(n + 1, 0);
- for (auto& i : a) {
- int x, y; char c;
- cin >> x >> c >> y;
- i = x * y;
- }
- sort(all(a)); for (int i = 0; i < n; ++i) pref[i + 1] = pref[i] + a[i];
- if (k > 1e11 || t > 1e11 || cnt(k) + cnt(t) >= 15) {
- cout << n; return 0;
- }
- const double eps = 1e-9;
- int ans = 0;
- for (int i = 0; i <= n; ++i) {
- if ((double)t - 1.0 * pref[i] / k > eps) {
- ans = max(ans, i);
- }
- }
- cout << ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement