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.
33 lines
738 B
33 lines
738 B
2 years ago
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
const int N = 10010;
|
||
|
typedef long long LL;
|
||
|
struct Person {
|
||
|
int left, right;
|
||
|
} person[N];
|
||
|
int n;
|
||
|
|
||
|
bool cmp(const Person &a, const Person &b) {
|
||
|
return a.left * a.right < b.left * b.right;
|
||
|
}
|
||
|
|
||
|
int main() {
|
||
|
cin >> n;
|
||
|
//输入
|
||
|
for (int i = 0; i <= n; i++)
|
||
|
cin >> person[i].left >> person[i].right;
|
||
|
//排序,注意国王不参加排序
|
||
|
sort(person + 1, person + 1 + n, cmp);
|
||
|
|
||
|
LL lcj = 1;//连乘积
|
||
|
LL res = 0;
|
||
|
for (int i = 0; i <= n; i++) {
|
||
|
//猴子选大王
|
||
|
res = max(res, lcj / person[i].right);
|
||
|
//更新连乘各
|
||
|
lcj *= person[i].left;
|
||
|
}
|
||
|
printf("%d", res);
|
||
|
return 0;
|
||
|
}
|