You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
687 B

#include <bits/stdc++.h>
using namespace std;
const int N = 10010;
typedef long long LL;
struct Person {
int first, second;
} p[N];
int n;
bool cmp(const Person &a, const Person &b) {
return a.first * a.second < b.second * b.first;
}
int main() {
cin >> n >> p[0].first >> p[0].second; //n:表示大臣的人数;a,b:分别表示国王左手和右手上的整数
for (int i = 1; i <= n; i++)cin >> p[i].first >> p[i].second;
sort(p + 1, p + 1 + n, cmp);
LL sum = 1;
LL MAX = 0;
for (int i = 0; i <= n; i++) {
MAX = max(MAX, sum / p[i].second);
sum *= p[i].first;
}
cout << MAX << endl;
return 0;
}