This commit is contained in:
HuangHai
2025-08-30 18:35:01 +08:00
commit 1f397eca87
6258 changed files with 1487241 additions and 0 deletions

33
TangDou/AcWing/114.cpp Normal file
View File

@@ -0,0 +1,33 @@
#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;
}